2
Answers

Is that possible to refer foreign key in external database?

Mustafa Salman

Mustafa Salman

12y
1.9k
1
Hi All
I have Two Database DB1 Have TBL1, DB2 Have TBL2
 and I need a foreign key in the [TBL1] table (which is in DB1 database) is reference to the other table [TBL2] (which is in the DB2 database).
 
 When i try to creating them through SQL, I received the following error message :


 Msg 1763, Level 16, State 0, Line 1
 Cross-database foreign key references are not supported. Foreign key 'SAMPLEDB..VENDOR'.
 Is that possible to refer foreign key in external database?
 
 If possible, please give solution for this. If not possible, please suggest some alternate way.
Answers (2)