How to Add Foreign Key relationship between two Databases.
I have two tables in two different databases. In table1(It is in database1) there is a column called ID and it is a primary key. Now in table2(It is in databse2) there is a column called Table1ID and I want to add it as a foreign key.
I tried to add it and it gave me the following error:
Msg 1763, Level 16, State 0, Line 1
Cross-database foreign key references are not supported. Foreign key Database2.table2.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint. See previous errors.