Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Violation of PRIMARY KEY constraint 'PK

Author  Topic 

creativegenius
Starting Member

1 Post

Posted - 2011-11-11 : 01:47:04
I am getting this error when i am checking the logs of my application:

[Databases] Exception : dbi.integrity-error, [Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY constraint 'PK__tblRaw201131411__13D55980'. Cannot insert duplicate key in object 'dbo.tblRaw201131411'. in EXEC

[Databases] Exception : dbi.integrity-error, [Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY constraint 'PK__tblRaw201131412__407DE2C5'. Cannot insert duplicate key in object 'dbo.tblRaw201131412'. in EXEC
File "mssqlinterface.py", line 951, in executeSQLStatement


How to fix this error?

my application is using SQL 2005 Database

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-11-11 : 02:00:02
I don't think there's anything to fix, per se. The application tried to violate the primary key constraint, which would have meant a duplicate. This is a legitimate error. If you don't want to see errors in your logs like this, then suppress them.

If, however, you think this error is a problem, then you'll need to see if you need to make an adjustment to the primary key constraint's columns.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -