SQL Question | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

SQL Question

I’ve been looking all over the place and can’t express my question clear enough for a search engine, so I’m hoping you guys can help me out. I have multiple databases that (by design) depend upon each other and need to be able to query between them. For example I have an ‘Employee’ database and a ‘Credit’ database (for employees who are allowed to issue credits to customers) I am currently just storing the employee id in the credit database and intended to reference it to retrieve employee data from the employee database. The problem is this, to put it simply: I don’t know the syntax to query more than one database at a time and compare values between them. Can anyone help me out?
select employee.dbo.employee_rec.field1, employee.dbo.employee_rec.field2, employee.dbo.employee_rec.field3
from employee.dbo.employee_rec join Credit.dbo.History
on employee.dbo.employee_rec.empid = Credit.dbo.History.recid
Gaurav
Thanks! That did the trick. <img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />
]]>