Fetching data of another server's table without using Linked Server

Bandi
Posted by Bandi under Sql Server category on | Points: 40 | Views : 257
SELECT * FROM [XXXX\SQLSERVER].study.dbo.SampleTable


if you get the error as below, then you can fetch data by using OPENROWSET distributed query without creating linked server object.
Msg 7202, Level 11, State 2, Line 1
Could not find server 'XXXX\SQLSERVER' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.



SELECT * FROM OPENROWSET('SQLNCLI', 'Server=XXXX\SQLSERVER;Trusted_Connection=yes;',
'SELECT * FROM study.dbo.SampleTable')

Comments or Responses

Login to post response