I have tried to change the customerID number for the sales table but constantly facing constraints issues.
UPDATE sales
set s.customerId = '15'
from sales s
where s.customerId = '28'
and s.merchantType in ('TS', 'CT');
SQL Error [2601][23000] attempt to insert duplicate key in object 'sales' with unique index 'sales_PKC'
sales_PKC Primary Key Index (CustomerID, Order_ID): clustered, FOREIGN_REFERENCE
Basically i am trying to change records with CustomerID 28 and merchantType TS and CT to 15 but kept return with error shown below. It seems to be creating duplicate records but i am not sure how what to do without dropping the constraints. Any suggestion would be greatly appreciated.