UPDATE POLICY_X_INSURED
SET POLICY_X_INSURED.INSURED_EID = '5712'
FROM POLICY_SUPP
WHERE POLICY_SUPP.POLICY_ID = POLICY_X_INSURED.POLICY_ID
AND POLICY_SUPP.LOCATION_CODE = '5752'
AND INSURED_EID <> '5712'
AND INSURED_EID <> '72703'
I get back this error:
Server: Msg 2601, Level 14, State 3, Line 1
Cannot insert duplicate key row in object 'POLICY_X_INSURED' with unique index 'POLICY_X_INS_PK'.
The statement has been terminated.
Obviously it has something to do with unique index; the problem is this makes no sense to me, how do i get around this error to update the fields i need to update? The queries should work as I have tested them on a table with the same fields and same data, but I did not put an Index or anything on there...Thanks!
Tags: