sqlsql-serverlinked-server

How to find destination IP address of a linked server in SQL Server 2008?


How can I find the address of defined linked server in SQL Server 2008? The link server is present and its connection test shows there is no problem. but I can not find where the link server connects to. The properties box did not lead to the answer.

Thank you.


Solution

  • From inside SQL Server if the target is SQL Server 2005+

    SELECT * FROM OPENQUERY (
             myLinkedServer, 
             'SELECT
                 @@SERVERNAME AS TargetServerName,
                 SUSER_SNAME() AS ConnectedWith,
                 DB_NAME() AS DefaultDB,
                 client_net_address AS IPAddress
              FROM
                  sys.dm_exec_connections
              WHERE
                  session_id = @@SPID
            ')
    

    You can adapt this anyway you want of course.