SQL: Violation of SQL Server UNIQUE KEY constraint but entry doesn't already exist
One issue that comes up time and again in the forums is when an INSERT statement fails with a violation of a UNIQUE or PRIMARY KEY constraint but when the user checks the existing table, the value that’s being complained about isn’t already in the table.
The Symptom
For example, a table might have primary key values of 2, 12, and 14.
When an INSERT is performed, there is an error telling you that you can’t insert a duplicate key value of say 15.
2019-12-26



