Home Forums SQL Server 2005 Administering Command to know no of users connected to particular database? RE: Command to know no of users connected to particular database?
Tony-464124
SSC Rookie
Points: 30
More actions
April 14, 2009 at 10:19 am
#977396
Here is the query you are looking for
SELECT DB_NAME(dbid) as 'Database Name',
COUNT(dbid) as 'Total Connections'
FROM master.dbo.sysprocesses WITH (nolock)
WHERE dbid > 0
GROUP BY dbid