I am using SQL Server 2012. I have defined a foreign key constraint on a table. The foreign key references composite primary key. The fk constraint does not work when one co
While you really should have provided a complete example as Zohar Peled said, it is likely that your problem lies in the WITH NOCHECK
option in the foreign key definition. It should be CHECK
to make the foreign key enabled and enforced by the engine. The way it is, the constraint is not trusted.
See What is lost when I create a Foreign Key using WITH NOCHECK for examples what happens when you use this option.