Subject | Re: [firebird-support] Triggers and referential integrity |
---|---|
Author | Martijn Tonies |
Post date | 2003-10-21T08:47:32Z |
Hi Tim,
child tables!! - with that particular value. Raise an EXCEPTION and the
DELETE will be aborted.
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird & MS SQL Server.
Upscene Productions
http://www.upscene.com
> :-) I already make extensive use of domains with check constraints - thewith
> primary table has every field except the primary key field as a domain
> a check constraint.with
>
> As I said, the problem isn't the Inserts so much as the deletes. In the
> case of a tax table (we also have three here), how do I prevent the user
> from deleting a tax type if there are any records in the primary table
> that tax type?In a BEFORE DELETE trigger, check to see if there are any rows - in all
child tables!! - with that particular value. Raise an EXCEPTION and the
DELETE will be aborted.
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird & MS SQL Server.
Upscene Productions
http://www.upscene.com