Re: FK - automatic value change when parent changes
Date: Fri, 26 Feb 2010 10:56:59 +0100
Op 26-2-2010 9:36, eh schreef:
> we have a Fk pointing to a parent table/column - and now sadly enough
> that primary key value will change.
> What would be a smart way to implement this change to these child
> tables ?
> Disabling FK's and a lot of update clauses or .... ??
If it changes, it's not a primary key... Anyway, if there are no other unique keys on the master table, do not change the key, but copy the record with a new pk, restore child connections by updating the foreign keys and delete or archive the original master record. Note that while performing these actions, queries may give wrong results (sum, count, etc).
Shakespeare Received on Fri Feb 26 2010 - 03:56:59 CST