Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Connecting to and Accessing a SQL Server Database

Author  Topic 

falcon_greatly
Starting Member

1 Post

Posted - 2010-12-04 : 21:11:45

I want to make a select from two databases.

Also, I have a program that creates a server with the name of the program beside the server of my computer.

I want to make a select from two servers.

Thanks in advance
for your reply.

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-12-05 : 00:45:10
Add one of the server as Linked server in the other server.
User four part name in your query and join it.

Example:
Select a.column1, a.column2, b.column1, b.column2, b.column3
from
FirstServerName.DatabaseName.OwnerNameOrSchemaName.TableName a
inner join
SecondServer.DatabaseName.OwnerNameOrSchemaName.TableName b
on a.commoncolumnname = b.commoncolumnname
Go to Top of Page
   

- Advertisement -