From: John A Grandy on
Do insert duplicate key errors always throw error number 2601 ?


From: Eric Isaacs on
I think it would depend on the table and the constraints on the table
as to which error was thrown first. 2601 is probably the most common,
but others could occur as well, including primary key errors.

You can search the error text below for other possibilities:

SELECT
*
FROM
sys.messages
WHERE
TEXT LIKE ('%' + 'insert dup' + '%')
AND LANGUAGE_id = 1033

-Eric Isaacs
From: Plamen Ratchev on
When you violate PRIMARY KEY or UNIQUE constraint the error number is 2627,
with message like:

Violation of PRIMARY KEY/UNIQUE KEY constraint 'constraint_name'. Cannot
insert duplicate key in object 'table_name'.

HTH,

Plamen Ratchev
http://www.SQLStudio.com

 | 
Pages: 1
Prev: A small speed problem
Next: Find date ranges