Violation of PRIMARY KEY constraint in UPDATE statement
Posted on 2006-06-23
I am trying to update a table and I keep getting the "Violation of PRIMARY KEY constraint 'PK_tblAddress_List'. Cannot insert duplicate key in object 'tblAddress_List'. The statement has been terminated." error message.
I made a temporary table of tblAddress_List without any primary keys/constraints and the update worked beautifully. This is the code I used:
set listid = 344
from tblAddress, tblAddress_List
where tblAddress.id=tblAddress_List.addressid and tblAddress.active = 0
Since I'm a beginner, can someone tell me how I can update the table without getting the error? Getting codes would help.