How to check the active connections for each Database in SQL Server 2005
We need to check the number of active connections for a Database on our server.
We can get that details by using the following SQL script. This SQL script displays the DatabaseName, the number of connections and the login name :
SELECT db_name(dbid) as DatabaseName, count(dbid) as NoOfConnections,
loginame as LoginName
WHERE dbid > 0
GROUP BY dbid, loginame