How to join tables from different servers?
EXEC sp_addlinkedserver SERVER_01
GO
/* The following command links 'sa' login on SERVER_02 with the 'sa' login of SERVER_01*/
EXEC sp_addlinkedsrvlogin @rmtsrvname = 'SERVER_01', @useself = 'false', @locallogin = 'sa', @rmtuser = 'sa', @rmtpassword = 'sa password of SERVER_01'
GO
SELECT a.title_idFROM SERVER_01.pubs.dbo.titles aINNER JOIN SERVER_02.pubs.dbo.titles bON a.title_id = b.title_idGO
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home