Finding server name on remote server

  • You have to write a SP on the remote server that does this

    select host_name()

     

    Then you have to execute that SP from the linking server.


    N 56°04'39.16"
    E 12°55'05.25"

  • If you have a linked server, the properties of the link are in system table master..sysservers.

    SELECT datasource

    FROM master..sysservers

    WHERE srvname = 'YourLinkAlias'

  • Thank you both for your replies. 

    I had looked at sysservers but I want to run the same query on all servers from one server that has all the 'linked' ones configured.  I also need to join this against user tables and therefore can't hardcode aliases.

    I had thought of creating a table on each DB with the servername in it, I guess similar to the host_name () option.

    Thanks very much for your response

     

Viewing 3 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply