From which version did SQL Server start showing the actual duplicate value in primary key violations

mo boy 396 Reputation points
2024-02-01T13:14:54.7066667+00:00

Dear Experts, Could you please let me know from which version did SQL Server start showing the actual duplicate values in primary key violations. Take for example, in some older versions, I only see something like this. "Violation of PRIMARY KEY constraint . Cannot insert duplicate key in object blah" Whereas in later versions, we can see the duplicate values which is way more useful. "Violation of PRIMARY KEY constraint. Cannot insert duplicate key in object blah. The duplicate key value is (2331). " Thanks,

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,917 questions
SQL Server Transact-SQL
SQL Server Transact-SQL
SQL Server: A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.Transact-SQL: A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
100 questions
0 comments No comments
{count} votes

Accepted answer
  1. Erland Sommarskog 112.2K Reputation points MVP
    2024-02-01T22:00:34.44+00:00

    I did some testing, and it seems that this improvement of the message was introduced in SQL 2008. That is, I get it on SQL 2008, but not on SQL 2005 or SQL 2000.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.