Determine number of active connections to each database in SQL Server
So I am taking databases offline and I need to find out which ones have active connections to them. People usually do a
However that brings a lot of info that I don’t need. I prefer to use this query so I see the DBs with number of connections!
DB_NAME(dbid) as DBName,
COUNT(dbid) as NumberOfConnections,
loginame as LoginName
dbid > 0