Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Programming / SQL / July 2008

Tip: Looking for answers? Try searching our database.

insert duplicate key errors

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John A Grandy - 23 Jul 2008 01:34 GMT
Do insert duplicate key errors always throw error number 2601 ?
Eric Isaacs - 23 Jul 2008 03:02 GMT
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
Plamen Ratchev - 23 Jul 2008 03:19 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.