We Talk Coding

How do I link tables between two SQL 2005 databases on the same server?

I have two SQL 2005 databases - GIS db contains tree tag IDs and Trees db contains info about each tag. I'd like to establish a link/relationship (preferably one that allows referencial integrity) between tables in each database. Is it possible to include tables from another database in a database diagram? Thanks so much for the help!

Public Comments

  1. You are probably better off moving all the tables to the same database. This removes many problems found in multi-database operations and is very much faster. It also increases security as you need only one database connection at any time.
  2. You'll need to create a database link between the two databases. I don;t know if referential integrity checks will span those links so to do that, you may need to create triggers to perform the checks yourself. I wouldn't recommend that though as it puts additional overhead on processing.
Powered by Yahoo! Answers