All about sp_addlinkedserver syntax

sp_addlinkedserver linked 2 servers. Once sp_addlinkedserver query executes, query can be run against these servers.

Run below queries one by one to link, to provide login credentials and to access data

EXEC sp_addlinkedserver @server='ServerName'
EXEC sp_addlinkedsrvlogin 'ServerName', 'false', NULL, 'username', 'password'
select * from [ServerName].[DBName].[DBO].[TableName]

Once your requirement is done, you may drop the linking by running following query.
EXEC sp_dropserver 'ServerName', 'droplogins'

Comments

Popular posts from this blog

CAML Query in SharePoint 2010

Calling REST APi from server side code - C#

All about SharePoint 2010 Content Type Hub

SharePoint Interview Questions and Answers

Calling ASP.Net WebMethod using jQuery AJAX