Showing posts with label sql server. Show all posts
Showing posts with label sql server. Show all posts

Wednesday, February 25, 2015

Find current sql sessions in MS SQL SERVER, getting also client IPs

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