How to find the no concurrent users ?

  • How to find the no concurrent users in a database and on a server using T-SQL but not using sp_who.

  • select count(*) from master..sysprocesses

    where db_id = dbid('dbname')

    Cursors never.

    DTS - only when needed and never to control.


    Cursors never.
    DTS - only when needed and never to control.

  • quote:


    select count(*) from master..sysprocesses

    where dbid = db_id('dbname')


    This will give you then number of spids

    select count(distinct loginame) from master..sysprocesses 
    
    where dbid = db_id('dbname')

    will give you the number of users by login irrespective of the number of connections they make. If you are using sql logins then the same login could be used by many different users.

    select count(*)
    
    from (select distinct hostname,loginame from master..sysprocesses
    where dbid = db_id('dbname')) a

    will give you the number of users by hostname/login irrespective of the number of connections they make

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply