Introduction
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 a number of opened connections 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 the above code, you will get a result something like below:
Enjoy reading!
Najmul Hoda is a Master of Computer Application.
He has worked with .Net technologies in web development and has been programming since 2007.
He is very comfortable in various languages,RDBMS,C# to VB.NET with Access & MS SQLServer from Javascript,AJAX to ASP.NET, MVC.
Khata Wata (Free Online Udhar Khata, Bahi Khata)
Download from play store