user3034025
user3034025

Reputation: 11

Table Join between Servers

I need to compare result sets from different servers. The tables I want data from share a primary key.

Question:

Because I have a primary key, can I query data using a simple join

(ie 'Server1.db1.dbo.table1.primarykeyfield = Server2.db2.dbo.table2.primarykeyfield)

without having to use the stored proc (sp_addlinkedserver) ?

Upvotes: 1

Views: 60

Answers (2)

Yosi Dahari
Yosi Dahari

Reputation: 6999

You need a way to access the remote table, and for doing that you will need to have a linked server configured.

This has nothing to do with primary key.

Please note this is a one time configuration, you can read more about it in the MSDN documentation.

Upvotes: 1

PermaNoob
PermaNoob

Reputation: 869

That depends on whether or not they are already linked servers. Once they are linked, though you should be able to do a simple join.

Upvotes: 0

Related Questions