Showing posts with label handy sql scripts. Show all posts
Showing posts with label handy sql scripts. Show all posts

Tuesday, 22 November 2016

Connection IP’s to my database

Thanks to @j_mcmullan

Apperently there's a lot more info on these tables

 select distinct--c.session_id
	  c.client_net_address
	  ,s.database_id
	  ,db_name( s.database_id)
from sys.dm_exec_connections c
    inner join sys.dm_exec_sessions s on c.session_id = s.session_id
where s.database_id = db_id('ASPState')
GO

(I beleiveit may be ironical that I was looking at sessions to a session database).