Friday, November 27, 2009

Get current connections

Sys.dm_exec_connections - Returns information about the connections made to the instance of the SQL Server and the details of each connection.

SELECT t1.session_id
, t2.login_name
FROM sys.dm_exec_connections t1
INNER JOIN sys.dm_exec_sessions t2 ON t1.session_id = t2.session_id

No comments:

Post a Comment