添加LinkServer
EXEC master.dbo.sp_addlinkedserver
@server = N'172.16.201.240', @srvproduct=N'SQL Server'
添加登录:
EXEC master.dbo.sp_addlinkedsrvlogin
@rmtsrvname = N'172.16.201.240',
@locallogin = N'sa',
@useself = N'False',
@rmtuser = N'sa',
@rmtpassword = N'symbio'
删除:
IF EXISTS (SELECT srv.name
FROM sys.servers srv
WHERE srv.server_id != 0
AND srv.name = N'172.16.201.240')
EXEC master.dbo.sp_dropserver @server=N'172.16.201.240', @droplogins='droplogins'