Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to SQL, so need a little help. I have to join two tables which are in two different databases which are on different servers. Can someone please tell me how can I do that?

share|improve this question

You sure can, as long as you have permission to access the tables on the other server. Just qualify the table names with the server name, database name, and schema name, like so:

SELECT * FROM otherserver.testdb.dbo.MyTable

You'll have to first set up the remote server as a "linked server" - you should be able to find plenty of guides for doing that with a little Google searching, or just pester your local DBA. It's pretty easy when connecting two SQL Server systems, but Kerberos can be a little fussy if you want to impersonate Windows credentials.

share|improve this answer
Thanks for the answer – sharepoint99 Mar 29 '11 at 2:27
@sharepoint99 If you feel this answer sufficiently resolves your problem, you should accept it as the answer (there should be a checkmark on the left side you can click). – bhamby Mar 29 '11 at 20:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.