I was asked to update a SQL Server table's primary key column, the column already has values. On inner joining with few other tables, I had to update the PK column values from another table. It's failing to do so due to duplicates, inserting value 435 to 2 or more PK column.
Any suggestion how it can be done?
UPDATE t SET t.ID = c.NewID FROM Table1 t INNER JOIN Table2 p ON p.ID = t.ID LEFT OUTER JOIN Table3 c ON c.ID = t.ID WHERE c.status = 'Y'