Find SQL Server Users that are Connected to your Database

This DMV query will let you determine who is connected to your database, and how many sessions they have.

--  Get SQL users that are connected and how many sessions they have 
    SELECT login_name, count(session_id) as session_count 
    FROM  sys.dm_exec_sessions 
    GROUP BY login_name

Technorati Tag: SQL Server

Advertisements
This entry was posted in SQL Server 2005. Bookmark the permalink.

One Response to Find SQL Server Users that are Connected to your Database

  1. Colin Shaw says:

    Thanks – just what I was looking for. Would have taken me FOR EVER to find the correct view!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s