读书人

插入临时表,该怎么处理

发布时间: 2013-11-15 22:28:15 作者: rapoo

插入临时表
如下面的代码


Select ID,Color from TrimPO_InputData where HeadID=1
Union all
Select ID,Color from TrimPO_InputData where HeadID=1
Union all
Select ID,Color from TrimPO_InputData where HeadID=1

请问该如何才可以插入一张临时表?
在线等,请不吝赐教!
[解决办法]
select * into #tmp from 
(
Select ID,Color from TrimPO_InputData where HeadID=1
Union all
Select ID,Color from TrimPO_InputData where HeadID=1
Union all
Select ID,Color from TrimPO_InputData where HeadID=1) a

[解决办法]
呵呵,总之就是,不用特意去建立临时表,可以直接select * into #临时表名称 from 表

读书人网 >SQL Server

热点推荐