hi, friends
I want to know that how do you join tables from different databases?
Join Tables From Different Databases
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Javeed M ShaikhRank #839 · 2.7K reputationPosted Nov 1, 2011, 5:42 PM EDT
you can directly give the name of the database to perform join, for example:
SELECT a.column1, b.column2 FROM DBFirst.dbo.TableA a inner join DBSecond.dbo.TableB b ON a.IDColumn=b.IDColumn;
Satyapriya NayakRank #47 · 31.5K reputationPosted Nov 1, 2011, 7:06 PM EDT
Please Refer Our recommended articles
Table Join in SQL 2005
Thanks
Suthish NairRank #92 · 22.8K reputationPosted Nov 2, 2011, 12:16 AM EDT
Syed Nayab Ali33 reputationPosted Nov 2, 2011, 7:40 AM EDT
It is very simple to make join tables from different database ........
Basic concept of join is similar, just use database name before table name
suppose u have 2 database, EmpDetail & SalaryDetail. There is a parent child relationship on the basis of EmpId.
so u can make join like this
select a.empname, a.empaddress, b.salary, b.accountId from EmpDetail.dbo.EmpAddress a inner join SalaryDetail.dbo.Salaryaccount b on a.EmpID = b.EmpId