简体   繁体   中英

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) ?

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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM