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!

HELP: SELECT two related tables in differents databases

Status
Not open for further replies.

fic

Programmer
Apr 10, 2000
2
ES
I wanna know if it's possible to SELECT items from two tables related, each one in a different database.<br><br>For instance, there are two tables Table1 in Database1 and Table2 in Database2. I want to JOIN Table1 and Table2. How can I do this?<br><br>I've tried with the USE clause, but only accepts one Database name.<br><br>Please, I need help.<br><br>Thanx.
 
What are the two RDBMS? If they are Oracle, Access or SQL Server it should be possible to set up link tables <p>Cal<br><a href=mailto: > </a><br><a href= > </a><br>
 
If you are using sql you can register the one server to the other using the sp_addlinkedserver and then login to one database and access the other database using<br><br>select ...<br>&nbsp;<br>from table1 a, server2.database2.user2.table2 b<br>where a.x = b.x<br><br>I have tried this in SQL Server 7.0 and it works <br>Oracle I am not sure, SQL and Access as calahans said, use linked tables in access...<br><br>
 
Try to make one DSN for both tables, so when you open your DSN, you can access both tables&nbsp;&nbsp;using simple JOIN command... it works fine with my Oracle DB, but it should always work...
 
With Oracle, just create a database link.<br>Then just use the link in your join:<br><br>WHERE my_table.value = your_table.value@your_db;<br><br>In this case, I am using a database link called your_db.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top