Reply to XOR and foreign key constraints

Your name:

Reply:


Posted by arzewski on 12/08/05 17:12

I have a situation where attending a meeting could be either staff or
coalition members. But don't know how to enforce a foreign key
constraint. any ideas ?

Table Meeting
MeetingID int NOT NULL,
AttendeeID int NOT NULL
Primary Key (MeetingID, AttendeeID)

Table Staff
StaffID int IDENTITY not null PRIMARY KEY

Table CoalitionMember
MemberID int Identity not null PRIMARY KEY

Since AttendeeID can either a value from Staff.StaffID or from
CoalitionMember.MemberID, I cannot place both constraints as

ADD CONSTRAINT [FK_Meeting_Staff] FOREIGN KEY
(AttendeeID)
REFERENCES [Staff] ([StaffID])

ADD CONSTRAINT [FK_Meeting_CoalitionMember] FOREIGN KEY
(AttendeeID)
REFERENCES [CoalitionMember] ([MemberID])

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация