网上找了很久,没有答案,大家有什么解决办法吗?

解决方案 »

  1.   


    2000:
    select * from sysprocesses
    2005或者2008:
    Fanr  12:17:32
    2005 以上 非2012 
    select * from sys.sysprocesses
      

  2.   

    select count(distinct hostname) from master..sysprocesses 
      

  3.   

    select count(distinct hostname) from master..sysprocesses  --此句获取本服务器上的连接人数select count(distinct hostname) from master..sysprocesses
    where  hostname <> '服务器名\实例名' --- 此句获取本服务器上该实例下的连接人数select count(distinct hostname) from master..sysprocesses
    where  hostname <> 'SVR005DE610\SQL2008' and  dbid=db_id('数据库名')  ---此句获取本服务器上该实例下该数据库的连接人数
      

  4.   


    select count(distinct hostname) from master..sysprocesses 
    --获取主机数
    居然让小F姐姐抢了风头
      

  5.   

    用户进程的spid都是大于50的, select count(*) '连接数'
     from master.dbo.sysprocesses 
     where spid>50
      

  6.   

    应该是这个吧,
    sys.dm_exec_session
    楼上的都是2000的,2005及2008只是保留,但是不推荐。
      

  7.   

    有很多重复的空的。
    应该如
    select count(distinct hostname) from master..sysprocesses  
      

  8.   

    我用这个select count(distinct hostname) from master..sysprocesses