Wednesday, November 21, 2018

SQL - List Linked Servers and Logins

SQL - List Linked Servers and Logins

Probably need sysadmin role for this. Copied from the internet, need to find refernce.

          ,'Local Login ' = case sl.uses_self_credential 
                            when 1 then 'Uses Self Credentials' 
           ,'Remote Login Name' = sl.remote_name 
      FROM sys.Servers ss 
 LEFT JOIN sys.linked_logins sl 
        ON ss.server_id = sl.server_id 
 LEFT JOIN sys.server_principals ssp 
        ON ssp.principal_id = sl.local_principal_id

No comments:

Post a Comment