• When you have a foreign key with more than one column it creates several scripts to create the same foreign key, and not common but here in the company where I work the model was created that way to test can use the script below.

    create table table_01 (cod int not null, dat datetime not null, nom varchar(10) )

    alter table table_01 add primary key (cod, dat)

    create table table_02 (id int identity,cod int not null, dat datetime not null, nom varchar(10) , work varchar(10) )

    ALTER TABLE table_02 ADD FOREIGN KEY (cod,dat) REFERENCES table_01(cod,dat)

    ALTER TABLE [table_02] DROP CONSTRAINT [FK__table_02__689D8392]

    ALTER TABLE [table_02] DROP CONSTRAINT [FK__table_02__689D8392]

    ALTER TABLE [table_02] ADD CONSTRAINT [FK__table_02__689D8392] FOREIGN KEY(dat)REFERENCES [table_01](dat)

    ALTER TABLE [table_02] ADD CONSTRAINT [FK__table_02__689D8392] FOREIGN KEY(cod)REFERENCES [table_01](cod)