Re: FK - automatic value change when parent changes

From: Shakespeare <whatsin_at_xs4all.nl>
Date: Fri, 26 Feb 2010 10:56:59 +0100
Message-ID: <4b879aeb$0$22935$e4fe514c_at_news.xs4all.nl>



Op 26-2-2010 9:36, eh schreef:
> Hi,
> 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 .... ??
>
> BR,
> timo

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

Original text of this message