2010-11-12

Copy and insert rows with identity column

SET IDENTITY_INSERT MakeMOney.dbo.ListingHistory ON   <–要設定
insert into MakeMOney.dbo.ListingHistory (ListingItemID,PackageID, ProductID, eBayItemID, Quantity, Sold, Price, HandlingFee, ListingFee, Title, StartTime, EndTime, ItemURL, Duration, Status,                       WarehouseID, HitCount, Lister, LastReviseDate)select  ListingItemID,PackageID, ProductID, eBayItemID, Quantity, Sold, Price, HandlingFee, ListingFee, Title, StartTime, EndTime, ItemURL, Duration, Status,                       WarehouseID, HitCount, Lister, LastReviseDate from ListingHistory where Status=’Active’ and year(StartTime)<=2008
↑insert時要指定欄位

沒有留言:

張貼留言