I'm trying to see how many open connections to my databases there are from my web pages.
I have over a 120 intranet users of which at least 80% are connected and working at any moment.
My attached code however ALWAYS only returns one connection...to a single database
I know that can't be correct there are at least 6 databases in use at any moment as well.
SELECT DB_NAME(dbid) as 'DbName', COUNT(dbid) as 'Connections'
from master.dbo.sysprocesses with (nolock)
WHERE dbid > 0 and DB_NAME(dbid) not in ('master','msdb')
GROUP BY dbid