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

Joining to multiple database

Status
Not open for further replies.

Jhankins

Programmer
Joined
Jun 17, 2003
Messages
46
Location
AU
i am using Query Analyzer and wish to join to another database.

select c.x,c.y
from
db1.db.tble c

join db2.db2.tble x on
c.x = x.x
where
x.batch like 'me%'

i am using SQL 2000 .. any help would be good
 
Minor adjustments

select c.x,c.y
from db1..tble c
INNER JOIN db2..tble x on c.x = x.x
where x.batch like 'me%'
 
I should have added -
This assumes they are on the same SQL Server instance.
 
Slight clarification:

To fully qualify an object name you can refer to it in the form: database.owner.object_name.

So in your example you might use: db2.dbo.tble.

However, if the owner is dbo then you can omit it, as in SonOfEmidec1100's answer.

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top