Exclusive Clothing Sale On Soft & Soothe

Get up to 63% off on our latest collection.

Shop Now

Find out how many users are connected to our SSMS database using SQL Server

 Here we will discuss to find out how many users are connected to our SSMS database using SQL Server.

Below is the query to find out the number of users is a connection to the SQL server.

This query works above SQL server 2005 version



SELECT conn.client_net_address, 
       SE.host_name, 
       SE.login_name, 
       ST.text
FROM   sys.dm_exec_sessions SE
	   INNER JOIN sys.dm_exec_connections conn
           ON SE.session_id = conn.session_id
CROSS APPLY sys.dm_exec_sql_text(conn.most_recent_sql_handle) ST
WHERE  SE.program_name LIKE 'Microsoft SQL Server Management Studio%'
ORDER BY SE.program_name, 
         conn.client_net_address;



----------------------------------------------------

Share this

Related Posts

Previous
Next Post »

Exclusive Clothing Sale On Soft & Soothe

Get up to 63% off on our latest collection.

Shop Now