0
我正在將數據從舊數據庫傳輸到新數據庫,並且在將數據插入新數據庫時需要保留舊數據庫的標識。但是,它不起作用。將行插入到具有預定義標識的表中
這是我的查詢:
SET IDENTITY_INSERT RentalEase.dbo.tblTenant ON
INSERT INTO RentalEase.dbo.tblTenant SELECT [ID]
,1
,[PropertyID]
,0
,[UnitID]
,[TenantName]
,[Sex]
,[BirthDate]
,[SSNO]
,[CoTenant1]
,[CoTenant1Sex]
,[CoTenant1BirthDate]
,[CoTenant1SSNO]
,[CoTenant2]
,[CoTenant2Sex]
,[CoTenant2BirthDate]
,[CoTenant2SSNO]
,[CoTenant3]
,[CoTenant3Sex]
,[CoTenant3BirthDate]
,[CoTenant3SSNO]
,[CarColor]
,[CarModel]
,[CarYear]
,[CarState]
,[CarPlateNumber]
,[Memo]
,[Address1]
,[Address2]
,[Address3]
,[Address4]
,[Phone]
,[ReferBy]
,[BeginDate]
,[NoticeGiven]
,[LeaseMonth2Month]
,[LeaseEnds]
,[DepositPaid]
,[DepositRefundable]
,[RefundMemo]
,[RentDueDay]
,[Charge1]
,[Charge1Amount]
,[Charge2]
,[Charge2Amount]
,[Charge3]
,[Charge3Amount]
,[Charge4]
,[Charge4Amount]
,[ContractText]
,[BalanceDue]
FROM [oldTables].[dbo].[tblCurrentTenant]
SET IDENTITY_INSERT RentalEase.dbo.tblTenant OFF
的SQL Server抱怨說,「當使用列列表只能指定表RentalEase.dbo.tblTenant」的標識列一個明確的價值和IDENTITY_INSERT爲ON 「。
我需要做些什麼才能使它起作用?
你打我吧。正是我要說的。 – HLGEM 2009-09-16 21:29:25