How to create a foreign key that references the entire composite key?

I have two tables that have a three component composite key. Another must reference this composite key.

What is the syntax for creating a foreign key that refers to multiple columns.

I tried googleing but I could not find it.

+5
source share
1 answer
FOREIGN KEY (col1, col2, col3) REFERENCES ParentTable (colA, colB, colC)

Look under " <table_constraint>" in online docs for Microsoft SQL Server CREATE TABLE .

+9
source

All Articles