exec sp_addlinkedserver
@server='test_hmc',
@srvproduct ='',
@provider ='MSDASQL',
@provstr ='driver={sql server};server=192.168.0.77;uid=sa;pwd='
go
exec sp_addlinkedsrvlogin @rmtsrvname='test_hmc',@useself='false',@locallogin='sa',@rmtuser='sa',@rmtpassword=''
go
删除连接
exec sp_droplinkedsrvlogin @rmtsrvname='remote173' ,@locallogin='sa' --删除登录用户
exec sp_dropserver 'remote173' --删除服务器
测试:
Select * from test_hmc.pubs.dbo.authors