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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Join tables which are located in separate DB, and even Separate Server 2

Status
Not open for further replies.

raminriahi

Programmer
Sep 9, 2002
31
US
I need to join tables which are located in different database and eventually different servers, but i don't know how it is possible? (either in Enterprise Manager, or even better than that Transact-SQL statement)
Please help me if you can !

Thanks in advance!
 
I believe when you identify objects between databases and servers the syntax is server.database.owner.tablename.

HTH

Ashley L Rickards
SQL DBA
 
I believe you also have to set themn up as linked servers. See BOL onthis topic and also read about distributed transactions.
 
Yes, you do need to set them up as a linked server.

See sp_addlinkedserver in BOL.

As for the Syntax it is the server.database.owner.tablename that was given above. You will want to alias that off, as SQL isn't often fond of 5 part names server.database.owner.tablename.columnname.

Denny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top