how many users connected to database?

  • Hi,

    Can you tell me if there is counter of the query that will let me check how many users are connected for to database? I know counter SQLServer:General Statistics: User Connections, however that one shows all users connected to the server. I would like to have it split by each data database.

  • k.przewozniak (2/20/2009)


    Hi,

    Can you tell me if there is counter of the query that will let me check how many users are connected for to database? I know counter SQLServer:General Statistics: User Connections, however that one shows all users connected to the server. I would like to have it split by each data database.

    no, that does not give you the number of users connected to a database it is user connections which is different. You can query sysprocesses table in the masters database, look for loginame and db_id.

  • select spid, status, loginame, hostname, blocked, db_name(dbid), cmd from master..sysprocesses where db_name(dbid) = 'EnterDBName Here'.

    HTH!

    MJ

  • Did you try

    sp_who2

    or

    SELECT * FROM sys.dm_exec_connections

    ?

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

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