[thelist] Foreign Key constraints
Andrew Kamm
akamm at demicooper.com
Fri Jun 9 10:42:37 CDT 2006
> You could put a DELETE TRIGGER on your state table, to go through your
> customer table, find any references to the state IDs being deleted and
> set them to NULL. Something like (I haven't tested this):
>
>
> CREATE TRIGGER trNullifyStateReferences ON states FOR DELETE
> AS
> UPDATE customers SET customers.state_id = NULL
> WHERE customers.state_id IN (SELECT state_id FROM deleted)
>
Excellent -- my deadline won't allow for it on this one, but I'll keep this
on file for future projects.
thanks-
--
Andrew Kamm
More information about the thelist
mailing list