且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将数据从一个表复制到另一个表

更新时间:2022-04-15 07:05:36

访问这里....





http://blog.sqlauthority.com/2012/10/31/ sql-server-copy-data-from-one-table-to-another-table-sql-in-sixty-seconds-031-video / [ ^ ]






http://www.sqlservercentral.com/Forums/Topic503363-8-1.aspx [ ^ ]
visit here....


http://blog.sqlauthority.com/2012/10/31/sql-server-copy-data-from-one-table-to-another-table-sql-in-sixty-seconds-031-video/[^]

or

http://www.sqlservercentral.com/Forums/Topic503363-8-1.aspx[^]


-- TempTable

Select  DATE,Car,Bike,Cycle Into #TableName
From
(Select DATE,SettingName,SettingValue From T01)u
PIVOT(Sum(SettingValue) For SettingName in(Car,Bike,Cycle)) AS Pvt

-- New Table
Create Table TableName (Columns)

Insert TableName

Select  DATE,Car,Bike,Cycle
From
(Select DATE,SettingName,SettingValue From T01)u
PIVOT(Sum(SettingValue) For SettingName in(Car,Bike,Cycle)) AS Pvt