T-SQL CLR to query session hostname

  • Comments posted to this topic are about the item T-SQL CLR to query session hostname

  • a touch overkill to get the hostname for sessions on your server perhaps?

    select s.host_name

    from sys.dm_exec_connections C

    join sys.dm_exec_sessions S on S.session_id = C.session_ID

    where C.client_net_address = '127.0.0.1'

    will provide the same information a lot simpler and safer than allowing a CLR on your system with External_Access

    However as an approach to allow a dns lookup from within sql server this is effective. I wrote something very similar 6 years ago when i was analysing web server logs associated with identifying click fraud and needed to do a lookup and at times a reverse lookup to fill the gaps in the data as provided by the logs.

  • Thanks for the script.

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

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