Multiple column foreign key contraints

Posted by eugene4968 on Stack Overflow See other posts from Stack Overflow or by eugene4968
Published on 2010-12-23T15:51:52Z Indexed on 2010/12/23 15:54 UTC
Read the original article Hit count: 172

I want to setup table constraints for the following scenario and I’m not sure how to do it or if it’s even possible in SQL Server 2005.

I have three tables A,B,C. C is a child of B. B will have a optional foreign key(may be null) referencing A. For performance reasons I also want table C to have the same foreign key reference to table A. The constraint on table C should be that C must reference its parent (B) and also have the same foreign key reference to A as its parent.

Anyone have any thoughts on how to do this?

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server-2005