Check constraint over two columns

Posted by Rippo on Stack Overflow See other posts from Stack Overflow or by Rippo
Published on 2011-01-04T11:31:30Z Indexed on 2011/01/04 11:54 UTC
Read the original article Hit count: 235

Filed under:
|
|

I want to add a Check Constraint to a table for server 2005 but cannot work it out.

MemberId ClubId MeetingId
1        100    10
2        100    10
3        100    10
7        101    10  <-This would throw a check constraint
1        100    11 
2        100    11  

I do not want to have more than one ClubId for a single MeetingId Basically a ClubId can only belong to a single MeetingId but can have more than one member assigned.

How do I achieve this?

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server