I am inserting data into a table from temp table as below:
INSERT INTO TBL_PERSON (PropertyID, PERSONID, FULLNAME)
SELECT DISTINCT PropertyID, PERSONID, FULLNAME FROM #SalesContacts
The unique key constraint is defined in Tbl_Person
using combination of PropertyId
, PersonId
and FullName
columns.
When this query is executed, how can I find out which combination of values are causing unique key constraint exceptions?
I want to log these values with the exception message.