I want to change the primary key value for one row in a table that has relations with other tables:
For example
Table Person { Id, Name, +50 fields }
Table Address { Id, City, +10 fields }
Table Person2Address { Id, PersonId, AddressId }
I want to change Person.Id and Person2Address.PersonId
I try something like:
BEGIN TRANSACTION
UPDATE Pers SET Id = NewId WHERE Id = OldId
UPDATE Person2Address SET PersonId = NewId WHERE PersonId = OldId
COMMIT TRANSACTION
But of course it provides conflicts :)
How can I temporary suppress foreign key constraints or is there a better way to change Id for person?