Link to home
Start Free TrialLog in
Avatar of edenmachine
edenmachine

asked on

How can you connect two tables together from two different databases?

I need to run a query that joins two tables from two different databases.
Avatar of mastoo
mastoo
Flag of United States of America image

Select * From DatabaseOneName..TableOneName Join DatabaseTwoName..TableTwoName On some join conditions here
Avatar of Aneesh
prefix "databaseName.." while specifying the table



from db1.dbo.Table1 a
inner join db2.dbo.Table2 b on a.id = b.id
ASKER CERTIFIED SOLUTION
Avatar of messen1975
messen1975

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 edenmachine
edenmachine

ASKER

Yes, they were in different servers so this is what I needed.
So what was the pbm with the above two comments