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.
[DATABASE] = DB_NAME(DBID),
GROUP BY DBID, LOGINAME
ORDER BY DB_NAME(DBID), LOGINAME
When you run above code you will get result something like below.