Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you create relationships between tables in different databases?

Status
Not open for further replies.

mojoT

Technical User
Sep 23, 2003
25
NZ
I have about 6 databases that I've made/making and some tables are required in more than one database.

These tables, which are used primarily as lookup tables for combo boxes etc, are hardly ever updated.

We're looking at creating a common database to store those tables that are needed by more than one module. My question is, can you create a relationship between two tables if they're in different databases? And, if you can, how is it done?

I do realise that you don't need to create relationships if your code is written properly, but the bosses want the relationships.

Any feedback would be greatly appreciated.
 
The can be no referential integrity between databases.

Thanks

J. Kusch
 
Is that in all databases, or just SQL Server? And why can't you? If I have a reason, then maybe I can justify it to my boss
 
Cross-database referential integrity constraints are implemented in some other databases but not in SQL Server.

AFAIK you can use triggers (FOR UPDATE, DELETE in common database, eventually FOR INSERT, UPDATE in foreign databases) to get the same functionality.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top