select count(spid) as counts, 
status, 
hostname, 
dbname 
= case 
when dbid = 0 then null 
when dbid <> 0 then db_name(dbid) 
end 
from master.dbo.sysprocesses 
where spid >=0 and spid <= 32767 and status='runnable' and db_name(dbid)='数据库名' 
group by status,hostname, 

case 
when dbid = 0 then null 
when dbid <> 0 then db_name(dbid) 
end 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
  • 2021-10-13
  • 2021-06-23
  • 2022-02-04
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-06
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
相关资源
相似解决方案