title: Constraint on cross-reference table that will check primary key table columns for integrity
body: <p>I have a cross-reference table which contains two foreign keys. RoleId(PK,FK) and PermissionId(PK,FK). The Role table and the Permission table both contain a foreign key column called ApplicationId. I want to ensure that a record cannot be inserted into the cross-reference table that contains a RoleId associated with ApplicationId 1 and PermissionId associated with ApplicationId 2. Is there any method other than using a trigger to accomplish this type of integrity?</p>