1

In order to help with debugging, I want to get the specific name of objects (like tables, constraints, indexes, etc.) which are involved when SQL Server raises an error.

How can this be done?

For example, I have an error 2627, which generates an error message like this: Violation of UNIQUE KEY constraint 'UQ__uniquete__3213E83E532B218D'. Cannot insert duplicate key in object 'dbo.uniquetest'. The duplicate key value is (1). I want to get the table name dbo.uniquetest and the constraint name UQ__uniquete__3213E83E532B218D. I can't see a way to get this from any SQL Client or even from the server itself.

codekaizen
  • 26,990
  • 7
  • 84
  • 140

0 Answers0