I am trying to run the following query:
update OAR.oa_AcademicHead
set personid=15857
where personid=1234
but I am getting the error:
Cannot insert duplicate key row in object 'OAR.oa_AcademicHead' with unique index 'IX_oa_AcademicHead_personid'.
The statement has been terminated.
What can be done to fix this??
A row where personid
is 15857
already exists in the table. The unique index on that column is preventing you from committing another record with the same personid
(an update is really a delete and insert).
You'll have to remove the existing person with that id first before running your query.*
* Disclaimer: make sure this is actually what you want to do; be aware of the issues it might cause.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With