March 13, 2006 at 11:41 am
I am trying to insert 3500 rows from table budget04 to budget05. I have an IDENTITY field in budget05 where there is no chance of inserting duplicate key but still I get this error message
Server: Msg 2627, Level 14, State 2, Line 1
Violation of UNIQUE KEY constraint 'IX_budget05. Cannot insert duplicate key in object budget05.
The statement has been terminated.
March 13, 2006 at 11:44 am
What is your unique constraint 'IX_budget05' ?
March 13, 2006 at 11:47 am
I have 3 columns appno,appseq,ledger for that constraint
March 13, 2006 at 12:06 pm
I assume appseq is the identity field?
Is IDENTITY_INSERT set on/off for the particular table? (see SET IDENTITY_INSERT in the books online)
What is your insert command?
March 13, 2006 at 7:42 pm
So, you need to have
GROUP BY appno,appseq,ledger
in your INSERT statement as well as
WHERE NOT EXIST (select 1 from IX_budget05 I
where <value for appno> = I.appno and <value for appseq> = I.appseq and <value for ledger> = I.ledger)
_____________
Code for TallyGenerator
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply