Subject | Re: [firebird-support] Re: Updating a stored procedure |
---|---|
Author | Gaurav Sood |
Post date | 2006-05-12T02:29:39Z |
> > I have a set of cascade delete procedures which delete all recordsHi Adam
> > associated with clients if you delete the profile of a client from a
> > People table within the database. The cascade delete will totally
> > remove all details of all clients and their relevant transcripts
> from
> > the database if you 'delete from People'.
>
> You have just reinvented the wheel.
>
> ALTER TABLE CLIENTS ADD CONSTRAINT FK_CLIENTS_1 FOREIGN KEY
> (PEOPLEID) REFERENCES PEOPLE (ID) ON UPDATE CASCADE ON DELETE CASCADE;
So according to this constraint, if I understand correctly, the table
Clients which has a foreign key PEOPLEID from table People (with
primary key ID), shall automatically cascade delete (or update as a
delete).
Therefore, I would have to add this constraint to all tables which use
the PEOPLE (ID) key as a foreign key.
Thanks
Gaurav
I think i've learnt my Generator lesson now.