Violation of PRIMARY KEY constraint.....Cannot insert duplicate key in object 'dbo.ItemAppliesTo'. error
Posted on 2010-09-20
I am trying to update all instances of a column (ResourceTargetGuid) in a Table (TBLE_A )
based on criteria in another table (Description field in TBLE_B = 'Marketing Group')
Here is my query:
SET ResourceTargetGuid = 'BDF0A71D-A058-480A-80FB-42F3571DBCED'
FROM TBLE_A ta INNER JOIN TBLE_B ta
ON tb.guid = ta.ItemGuid
WHERE tb.Description = 'Marketing Group'
Unfortunately, the following error is generated:
Violation of PRIMARY KEY constraint 'PK_TBLE_A'. Cannot insert duplicate key in object 'dbo.TBLE_A'.
The statement has been terminated.
Is there an edit in the query that can be made to work around this issue? TBLE_A has many records and based on this error I assume the column
ResourceTargetGuid is being used as a Primary key and I am attempting to update a record whcih already contains the value BDF0A71D-A058-480A-80FB-42F3571DBCED.
Please, any detail as to what I can do here is greatly appreciated.