小任班长的博客 - sqlserver view open/active connections
type: channel
link: https://cnxiaocheng.top/tag/sqlserver-view-open-active-connections/
items: sql server determine total number of open/active connections

sql server determine total number of open/active connections
type: item
date: 2019-07-21T09:00:00+08:00
description: This shows the number 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 show total ConnectionsSELECT COUNT(dbid) as TotalConnections FROM sys.sysprocesses WHERE dbid > 0 If you need more detail, run:sp_who2 'Active' Note: The SQL Server account used needs the 'sysadmin' role (otherwise it will just show a single row and a count of 1 as the result)