--view linked servers
exec sp_linkedservers
--OR
select * from sys.servers where is_linked = 1
--add a linked server
EXEC sp_addlinkedserver
@server=N'STAGINGCONNECT',
@srvproduct=N'SQL Sever',
@provider=N'SQLNCLI',
@datasrc=N'DB7830F';
--view the linked servers and the logins to the linked server
select s.name, p.principal_id, l.remote_name
from sys.servers s
join sys.linked_logins l
on s.server_id = l.server_id
left join sys.server_principals p
on l.local_principal_id = p.principal_id
where s.is_linked = 1
No comments:
Post a Comment