User Id :    Password :      New Member   Forgot Password  
 
How to check opened connection in sql server
Description Here is the code snippet to check how many database connections are opened in sql server.   No. of Views     1389
  Rating     0
Author Najmul Hoda   Posted On     06 Nov 2015
Tags ADO.NET,SQL SERVER,SQL SERVER 2008,SQL SERVER 2010,SQL SERVER 2012    

Sample Code   Download Code

 

Sometimes we need to know how many database connections are opened in sql server. So here is the code snippet that we can use to get number of opened connection per database.

 

SELECT 
[DATABASE] = DB_NAME(DBID), 
OPNEDCONNECTIONS =COUNT(DBID),
[USER] =LOGINAME
FROM SYS.SYSPROCESSES
GROUP BY DBID, LOGINAME
ORDER BY DB_NAME(DBID), LOGINAME

 

When you run above code you will get result something like below.

 

 

Enjoy reading...

About Author

About Author He is a team lead, having 8+ years of experience. He loves writing technical article for .Net developers. Najmul Hoda
No Photo
 
Country United States
Company BirlaSoft
Home Page http://www.magixchat.com

Rate this article

Rating options from poor, fair, good, very good to excelent.  
 

Comments

   
Write your comment here.
Comment
Verification Code