Number of open/active connections in ms sql server 2005
How to get total number of open/active connections in MS SQL Server 2005?
SELECT DB_NAME(dbid) as 'Database Name', COUNT(dbid) as 'Total Connections' FROM master.dbo.sysprocesses WITH (nolock) WHERE dbid > 0 GROUP BY dbid SELECT @@MAX_CONNECTIONS AS 'Max Allowed Connections'
This shows the no of connections per each DB:
SELECT DB_NAME(dbid) as DBName, COUNT(dbid) as NumberOfConnections, loginame as LoginName FROM sys.sysprocesses WHERE dbid > 0 GROUP BY dbid, loginame
And this gives the total:
SELECT COUNT(dbid) as TotalConnections FROM sys.sysprocesses WHERE dbid > 0
If you need more detail, run:
sp_who2 'Active'
Similar Posts
- Websites and Web Projects
- Developers/Job Seekers, did you consider Stackoverflow?
- 10+ Ways for testing website browser compatibility


