Home Forums SQL Server 2005 Administering Relationship information between tables situated at different databases RE: Relationship information between tables situated at different databases

  • it's not possible for a foreign key to reference a different database.

    foreign keys can only be created within the same database as the two tables exist in.

    it's possible to make a function, that returns, say 0/1 if a value exists in another database, and then use THAT to enforce a check constraint.

    it's a rare situation where someone puts something like that in place, but my first example would help you find those situations.

    so any references can only be inferred by using, say a udf plus a check constraint, or implied by joins in cross database views, maybe.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!