SQL Server 2000 incorrect message: duplicate key with unique index

Posted by iar on Stack Overflow See other posts from Stack Overflow or by iar
Published on 2010-03-11T14:10:16Z Indexed on 2010/03/11 18:39 UTC
Read the original article Hit count: 472

Filed under:

Database server: SQL Server 2000 - 8.00.760 - SP3 - Standard Edition

I have a table with 5 columns, in which I want to add a large (300.000) number of records. There is a unique index on the combination of two columns. If I add the records with this unique index in place, SQL Server gives this error message:

Msg 2601, Level 14, State 3, Line 1 Cannot insert duplicate key row in object 'TESTTABLE' with unique index 'test'. The statement has been terminated.

(0 row(s) affected)

However, if I delete the unique index and then add the records, I do not get any error when I create this unique index afterwards.

© Stack Overflow or respective owner

Related posts about sql-server