sql插入临时表数据的方法
生活随笔
收集整理的這篇文章主要介紹了
sql插入临时表数据的方法
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
方法有兩種,主要看需求。
方法1:定義好臨時表的字段和類型、插入對應(yīng)的值
create table #Tmp --創(chuàng)建臨時表#Tmp (City varchar(50), --Country varchar(50), -- );insert #Tmp select '北京','中國' union select '東京','日本' union select '紐約','美國' select * from #Tmp;?
方法2:直接將查詢出來的表數(shù)據(jù)插入臨時表中
if OBJECT_ID('tempdb..#temp') is not null drop table #temp select * into #temp from (--select * from Activityselect 7 as 'month',25 as 'day'union allselect 7 as 'month',25 as 'day'union allselect 8 as 'month',25 as 'day' union allselect 8 as 'month',25 as 'day'union allselect 8 as 'month',25 as 'day') as Aselect * from #temp?
?歡迎頂....
轉(zhuǎn)載于:https://www.cnblogs.com/hmYao/p/6428256.html
總結(jié)
以上是生活随笔為你收集整理的sql插入临时表数据的方法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 20gb流量可以刷抖音多久?
- 下一篇: 安卓后台进程限制标准是多少?