hi, friends
I want to know that how do you join tables from different databases?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Syed Nayab AliPosted Nov 2, 2011, 11:40 AM
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
Suthish NairPosted Nov 2, 2011, 4:16 AM
Satyapriya NayakPosted Nov 1, 2011, 11:06 PM
Please Refer Our recommended articles
Table Join in SQL 2005
Thanks
Javeed M ShaikhPosted Nov 1, 2011, 9:42 PM
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;