日期:2014-05-17  浏览次数:20397 次

插入临时表
如下面的代码

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 表