当前位置:Gxlcms > 数据库问题 > sql插入临时表数据的方法

sql插入临时表数据的方法

时间:2021-07-01 10:21:17 帮助过:78人阅读

50), -- Country varchar(50), -- ); insert #Tmp select ‘北京‘,‘中国‘ union select ‘东京‘,‘日本‘ union select ‘纽约‘,‘美国‘ select * from #Tmp;

技术分享

 

方法2:直接将查询出来的表数据插入临时表中

if OBJECT_ID(‘tempdb..#temp‘) is not null
drop table #temp
select * into #temp from 
(
    --select * from Activity
    select 7 as ‘month‘,25 as ‘day‘
    union all
    select 7 as ‘month‘,25 as ‘day‘
    union all
    select 8 as ‘month‘,25 as ‘day‘ 
    union all
    select 8 as ‘month‘,25 as ‘day‘
    union all
    select 8 as ‘month‘,25 as ‘day‘
 
) as A


select *  from #temp

技术分享

 

 欢迎顶....

sql插入临时表数据的方法

标签:image   varchar   blog   count   nbsp   alt   object   img   tmp   

人气教程排行