how do i resolve this SQL error

By dmuttunga ·
ASQL Error: '[Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY constraint 'PK_cat_validation'. Cannot insert duplicate key in object 'dbo.cat_validation'.' SQLState='23000' SQLNativeError=2627.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Couple of possibilities

by robo_dev In reply to how do i resolve this SQ ...

Duplicate key entries can happen when you reach the upper limit of the auto increment field, so, for example, if the DIM of the primary key is tinyint, the maximum is 127

Also, if this is suddenly happening on a working database, it is a sign that the table is corrupted and must be rebuilt/restored.

Collapse -

What is the SQL command?

by john.a.wills In reply to how do i resolve this SQ ...

Before we see that we cannot really be sure. But also look at your constraint PK_cat_validation: it may simply be that you are trying to insert with a primary key that is already there, and you should either set the value differently or use an update command instead of an insert one.

Related Discussions

Related Forums