I have two databases, is it possible to create a foreign key between two tables in different databases in SQL Server 2008?
thanks
From Books Online:
A FOREIGN KEY constraint can reference columns in tables in the same database or within the same table.
So, you can not create foreign key constraints between two tables in different databases.
This is one of disadvantages of using multiple databases.
If you are using Linq2Sql or the entity framework - You can do it in the designer.
But as Igor say - in the DB itself you cant do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With