Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

T-SQL CLR to query session hostname Expand / Collapse
Author
Message
Posted Thursday, May 31, 2012 9:55 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, October 21, 2015 10:28 AM
Points: 154, Visits: 469
Comments posted to this topic are about the item T-SQL CLR to query session hostname
Post #1309477
Posted Saturday, June 2, 2012 11:12 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, October 27, 2014 1:16 AM
Points: 129, Visits: 217
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.
Post #1310108
Posted Tuesday, May 10, 2016 9:26 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 6:58 AM
Points: 7,968, Visits: 784
Thanks for the script.
Post #1784810
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse