Link to home
Start Free TrialLog in
Avatar of tristan256
tristan256

asked on

Link tables in SQL Server

Ok, easy question.

How do you link tables in SQL Server?  That is, how do you access tables from other databases (on the same SQL Server)?
ASKER CERTIFIED SOLUTION
Avatar of arbert
arbert

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arbert
arbert

And if you wanted to join from the current database to tables in another database:

select * from currentdbtable t1 inner join otherdatabase.owner.tablename t2
on t1.key=t2.key
Avatar of tristan256

ASKER

aah, didn't know you had to specify the owner as well.

Cheers.
Good deal.  Always a good habit to get into to always include the owner...
What do I have to do,  so that the table in database A is available to all databases (B, C,...) In a way that any queries done by connecting to n B and C looks like the table is in B and C.
I do not want to use the fully qualified name nor do I want to change my code to add openquery statements.

The situation is I'm using dotnet code to query two databases that where split out of one.