Re: Q: referential constraints

From: Mike Tuason <mtuason_at_bio.ri.ccf.org>
Date: Tue, 24 May 1994 16:50:16 GMT
Message-ID: <1994May24.165016.20420_at_bme.ri.ccf.org>


>I have a question about referential integrity
>constraints on a table.
>
>I want to put a constraint on a table, so that two
>columns match what is in another table.
>
>The 'lookup' table is table "A". the table that I want
>to add the constraint to is table "B".
>
> - TEXT DELETED -
>
>The constraint that I want would allow (table B) rows where
>b_key = 1, 3, and 4; but not allow rows 2 and 5.

Ray,

Try using:

ALTER TABLE B ADD
  (CONSTRAINT B_A_FK

     FOREIGN KEY  (PART1,PART2)
     REFERENCES A (PART1,PART2)

  );

Be sure table b has matching rows in table a before trying the create the constraint on table.

Hope this helps!

Mike Tuason
Cleveland Clinic Foundation
mtuason_at_bio.ri.ccf.org Received on Tue May 24 1994 - 18:50:16 CEST

Original text of this message