The query below identifies all currently active SQL Server user connections by their SQL Server Login name. It provides details of the IP address that the connection is sourced from, along with the number of sessions and connections that the SQL Server Login is currently responsible for.
SELECT
B.login_name,
A.client_net_address,
NoOfConnections = COUNT(*)
FROM
sys.dm_exec_connections A
INNER JOIN sys.dm_exec_sessions B ON
A.session_id = B.session_id
GROUP BY
login_name,
client_net_address
SELECT
B.login_name,
A.client_net_address,
NoOfConnections = COUNT(*)
FROM
sys.dm_exec_connections A
INNER JOIN sys.dm_exec_sessions B ON
A.session_id = B.session_id
GROUP BY
login_name,
client_net_address
No comments:
Post a Comment