June 7, 2002 at 2:52 pm
Is it possible to have a Foreign Key in one db1 and its referenced table in db2 in another.
i.e.
I have a table in Database1 and I want to creat a foreign key pointing to a table in database2. Please let me know if this is possible. Thanks.
June 7, 2002 at 7:56 pm
From what I remember and I don't believe this has changed that answer is no. Also as printed in SQL BOL
quote:
Note A FOREIGN KEY constraint can reference columns in tables in the same database or within the same table (self-referencing tables), for example, an employee table that contains three columns: employee_number, employee_name, and manager_employee_number. Because the manager is an employee too, there is a foreign key relationship from the manager_employee_number column to the employee_number column.
Now this doesn't mean you cannot build a constraint to deal with it. Look at using a trigger but I believe you can run into issues with user permissions or DB access, unfortunately this is a concept for me as I have not had a chance to test, but it should work.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply