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

How to create a query to join tables in two different databases?

Status
Not open for further replies.

McCabeTC

Programmer
Aug 6, 2003
28
US
Hello,

I have two different databases in the same SQL Server (2000), which I need to join through a query. One of the databases has a table called "EMPLOYEE", and the other database has a table called "PROJECT" (which has the field EmployeeId). I need to get all last name, first name (located in the "EMPLOYEE" table) for all the projects in the "PROJECT" table, using the EmployeeId as the key/link.

I am fairly new to SQL Server and I would appreciate any help on that.

TM
 
To get you started on cross DB queries here is a template

SELECT e.LastName, e.FirstName
FROM DatabaseName1.dbo.Employee as e
JOIN DatabaseName2.dbo.Projects as p
ON (e.EmployeeID = p.EmployeeID)

Thanks

J. Kusch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top