find number of open connection on database

前端 未结 3 1812
死守一世寂寞
死守一世寂寞 2021-01-04 22:50

My web application is in asp.net 2.0,c#2.0 and sql server 208 how can i find number of open connections on my sql server 2008 database.and is there any way to clear connecti

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-04 23:12

    Sql query to get the current active connection

    SELECT DB_NAME(dbid) as 'DbNAme', COUNT(dbid) as 'Connections' from master.dbo.sysprocesses with (nolock) WHERE dbid > 0 GROUP BY dbid
    

    you can define dbid if you want connection specific to database

提交回复
热议问题