hi all,
I've copied tables that have an identiy col before, but this one has me stumped.
Both the from and To tables have identical layout and both of course have the Identity col in the same place.
Get error Violation of PRIMARY KEY constraint 'PK_FundTransactions'. Cannot insert duplicate key in object 'Fund Transactions'.
The PK is the Identity column.
I have this:
SET IDENTITY_INSERT dbo.[Fund Transactions] ON
INSERT INTO TAHOE.gm.dbo.[Fund Transactions]
([Dlr Num],
[Promo],
[Trans Type],
[Period],
[Trans Amt],
[Comment],
[Trans Date],
[Product Code],
[Product Group],
[Sales],
[Units],
[Last Modified],
[Operator],
[Fund Misc 1],
[Fund Misc 2],
[Fund Misc 3],
[Fund Misc 4],
[Fund Misc 5],
[ACB Comment],
ID,
[FileNumberIn],
[FileLineNumber])
SELECT
[Dlr Num],
[Promo],
[Trans Type],
[Period],
[Trans Amt],
[Comment],
[Trans Date],
[Product Code],
[Product Group],
[Sales],
[Units],
[Last Modified],
[Operator],
[Fund Misc 1],
[Fund Misc 2],
[Fund Misc 3],
[Fund Misc 4],
[Fund Misc 5],
[ACB Comment],
ID,
[FileNumberIn],
[FileLineNumber]
FROM GM.gm.dbo.[Fund Transactions]
WHERE ([Dlr Num] = '00000008524' OR
[Dlr Num] = '00000008506' OR
[Dlr Num] = '00000008623' OR
[Dlr Num] = '00000008505' OR
[Dlr Num] = '00000008533' OR
[Dlr Num] = '00000008528') AND (Operator <> 'mis load')
I've copied tables that have an identiy col before, but this one has me stumped.
Both the from and To tables have identical layout and both of course have the Identity col in the same place.
Get error Violation of PRIMARY KEY constraint 'PK_FundTransactions'. Cannot insert duplicate key in object 'Fund Transactions'.
The PK is the Identity column.
I have this:
SET IDENTITY_INSERT dbo.[Fund Transactions] ON
INSERT INTO TAHOE.gm.dbo.[Fund Transactions]
([Dlr Num],
[Promo],
[Trans Type],
[Period],
[Trans Amt],
[Comment],
[Trans Date],
[Product Code],
[Product Group],
[Sales],
[Units],
[Last Modified],
[Operator],
[Fund Misc 1],
[Fund Misc 2],
[Fund Misc 3],
[Fund Misc 4],
[Fund Misc 5],
[ACB Comment],
ID,
[FileNumberIn],
[FileLineNumber])
SELECT
[Dlr Num],
[Promo],
[Trans Type],
[Period],
[Trans Amt],
[Comment],
[Trans Date],
[Product Code],
[Product Group],
[Sales],
[Units],
[Last Modified],
[Operator],
[Fund Misc 1],
[Fund Misc 2],
[Fund Misc 3],
[Fund Misc 4],
[Fund Misc 5],
[ACB Comment],
ID,
[FileNumberIn],
[FileLineNumber]
FROM GM.gm.dbo.[Fund Transactions]
WHERE ([Dlr Num] = '00000008524' OR
[Dlr Num] = '00000008506' OR
[Dlr Num] = '00000008623' OR
[Dlr Num] = '00000008505' OR
[Dlr Num] = '00000008533' OR
[Dlr Num] = '00000008528') AND (Operator <> 'mis load')