FK constraint that can map to 2 PK tables

Hey experts,

 Can I have a foreign key constraint that states that field x in foreign key table a can map to field y in primary key table b OR field z in primary key table c....usually the constraint is only between 1 FK table & 1 PK table (and not 2)...so can the above be done??
LVL 3
mte01Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
unfortunately, this is a NO-GO. you cannot do this with a primary / foreign key constraint (or other constraints)
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
no.
you need to implement this using a trigger
0
 
mte01Author Commented:
>>angelIII

My problem is that I have an exisitng FK constraint to a PK table, and since I want to use the existing FK table for another purpose, and I don't want to remove the existing constraint, I thought it would be excellant if it could modify this constaint to make it map to 2 PK tables
0
 
mte01Author Commented:
>>angelIII

Ahaa...I see...thx for your help!..
0
All Courses

From novice to tech pro — start learning today.