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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Guy Hengel [angelIII / a3]Billing EngineerCommented:
unfortunately, this is a NO-GO. you cannot do this with a primary / foreign key constraint (or other constraints)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mte01Author Commented:
>>angelIII

Ahaa...I see...thx for your help!..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.