Re: Referential Integrity

From: Daniel Morgan <dmorgan_at_exesolutions.com>
Date: Thu, 23 May 2002 14:53:15 GMT
Message-ID: <3CED024C.2DCD4CB4_at_exesolutions.com>


surya wrote:

> I am having tow Tables like this.
>
> Table1(Id (Char),Name(Varchar))
> Table2(Name(Varchar))
>
> Primary Key is "Name" for both tables.
>
> My question is i want to maintain referential integrity between the
> above tables.
>
> Whenever i am updating a record of Table1 column "Id" with value "X" i
> need to delte the record in Table2.
>
> Can suggest a "Create table queries".
>
> Thanks in advance
> Surya

Write an AFTER UPDATE trigger on table1 to perform the delete. Be sure that it has an exception clause to handle situations where no corresponding record exists in table2.

Daniel Morgan Received on Thu May 23 2002 - 16:53:15 CEST

Original text of this message