July 7, 2014

How to add multiple foreign keys in a table from different reference tables in SQL

To  add multiple foreign keys in a table from different reference tables in SQL you can try below methods in sql query editor.

1. Alter table table_name add constraint constraint_name foreign key(col_name) references table_name(col_name) GO.

2.Create foreign constraint WITH NOCHECK first then CHECK it with another alter statement.. Make sure to put GO in between each statement.. Just to safe side, SET ANSI PADDING ON on the top and OFF at the button..

No comments:

Post a Comment