select count(*) from master.dbo.sysprocesses where dbid=db_id()
select
count(*)
from master..sysprocesses
where hostname<>'' and dbid=db_id('db')
select count(*) from master.dbo.sysprocesses where dbid=db_id()
select
count(*)
from master..sysprocesses
where hostname<>'' and dbid=db_id('db')