Create linked server with SQL command
can you help me to create linked server using some SQL command ?
subqu开发者_StackOverflowestion : How to remove it ?
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.
Here is a code example
--local linked server
EXEC sp_addlinkedserver
@server='FUSIONRIS',
@srvproduct='',
@provider='SQLNCLI',
@datasrc='MylocalServerName'
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.
精彩评论