How to determine total number of open/active connections in ms sql server 2005

前端 未结 8 2353
再見小時候
再見小時候 2020-11-27 09:06

My PHP/MS Sql Server 2005/win 2003 Application occasionally becomes very unresponsive, the memory/cpu usage does not spike. If i try to open any new connection from sql man

8条回答
  •  一整个雨季
    2020-11-27 09:54

    see sp_who it gives you more details than just seeing the number of connections

    in your case i would do something like this

     DECLARE @temp TABLE(spid int , ecid int, status varchar(50),
                         loginname varchar(50),   
                         hostname varchar(50),
    blk varchar(50), dbname varchar(50), cmd varchar(50), request_id int) 
    INSERT INTO @temp  
    
    EXEC sp_who
    
    SELECT COUNT(*) FROM @temp WHERE dbname = 'DB NAME'
    

提交回复
热议问题