Hi All;
What is the best way to swap the primary keys between two
records in the same table?
The basic situation is an accounting problem:
I have one person who has two legally different records in a table, zPeople. zPeople has children related records in other files for which Insert/update/delete are all cascaded on the primary key. Its easy enough to move all the children records from one primary key in zPeople to another as long as I don't touch either of the two records in zPeople. However, after moving the children records, I would like to keep the primary key of the most current (of the two) records in zPeople--which means at times moving the primary key from one record to another ( or swapping them), then deleting the no longer used record/primary key.
However, even if the record in zPeople to be deleted has its primary key changed to an unrelated value, putting its original value on another record causes:
'Uniqueness violation...error'
Surely, swapping primary keys in a relationtional database is a common manuever, but I can't seem to get arround this error.
Thanks for any help in advance!
Alan
What is the best way to swap the primary keys between two
records in the same table?
The basic situation is an accounting problem:
I have one person who has two legally different records in a table, zPeople. zPeople has children related records in other files for which Insert/update/delete are all cascaded on the primary key. Its easy enough to move all the children records from one primary key in zPeople to another as long as I don't touch either of the two records in zPeople. However, after moving the children records, I would like to keep the primary key of the most current (of the two) records in zPeople--which means at times moving the primary key from one record to another ( or swapping them), then deleting the no longer used record/primary key.
However, even if the record in zPeople to be deleted has its primary key changed to an unrelated value, putting its original value on another record causes:
'Uniqueness violation...error'
Surely, swapping primary keys in a relationtional database is a common manuever, but I can't seem to get arround this error.
Thanks for any help in advance!
Alan