Search code examples
sql-serversql-server-2008t-sqlstored-procedures

Is it possible to determine what caused a duplicate key values


I have a job who makes replication between two databases and after I insert new value in first table tbl_company_market_service_phone_number I get this error from the job ,and the value not exists in table which is replicated data (second table).

Error:Cannot insert duplicate key row in object 'tbl_company_market_service_phone_number' with    
unique index 'IX_tbl_company_market_service_phone_number_fld_uk'. The duplicate key value is   
(65b763ac-6f8f-4fe6-b76c-02a75b71dbe1).

How can I find what key value is (65b763ac-6f8f-4fe6-b76c-02a75b71dbe1)? Or find out the cause of job fail.


Solution

  • So it is not in the replicated data

    Did you check the source table

    It is telling you table name tbl_company_market_service_phone_number
    And that is the name of stated name of the source table