I have an odd ball situation...Table A has a 3 part compound key. (GroupID, PayorID, EffectiveDate)Table B need a check foreign key constraint that references only GroupID & PayorID.Of course, the following syntax generates the following error:[code="sql"]ALTER TABLE dbo.TableB WITH CHECK ADD CONSTRAINT fk_TableB_GroupID_PayorID FOREIGN KEY (GroupID, PayorID)REFERENCES dbo.TableA (GroupID, PayorID)ON UPDATE CASCADEON DELETE CASCADE;GO [/code][code="plain"]Msg 1776, Level 16, State 0, Line 22There are no primary or candidate keys in the referenced table 'dbo.TableA' that match the referencing column list in the foreign key 'fk_TableB_GroupID_PayorID'.Msg 1750, Level 16, State 0, Line 22Could not create constraint or index. See previous errors.[/code]I "feel" like this is something I should know how to get around but I'm drawing a blank... A push in the right direction would be greatly appreciated.Thanks in advance,Jason
↧