1

can you help me to create linked server using some SQL command ?

subquestion : How to remove it ?

3 Answers 3

4

Check this sp_addlinkedserver command in SQL server to add a linked server

Check sp_dropserver command in SQL server to remove a linked server.

Only the servername is mandatory to be supplied to this command, rest all parameters are optional.

Sign up to request clarification or add additional context in comments.

Comments

4

Here is a code example

--local linked server
EXEC sp_addlinkedserver   
   @server='FUSIONRIS', 
   @srvproduct='',
   @provider='SQLNCLI', 
   @datasrc='MylocalServerName'

Comments

0

There is a also a GUI in SSMS to set up linked servers. Be sure to create a login -> db user on each server and to create the mapping between these two db users correctly either via your script or in the GUI. Also these users should have the least possible permissions, as when you are using linked servers, you are doubling your attack surface.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.