Determining the number of Active users logged into a SQL Server Database

How does one Determine the number of Active users logged into a SQL Server Database

I want to use the info to control concurrent licensing for my Application



Answer this question

Determining the number of Active users logged into a SQL Server Database

  • mohawk

    Yes the data is real time, the server connection will disapear once the connection times out or the connection has been removed from the connection pool.

  • c_hales

    Thanks, I will. I believe this is exactly what I am looking for. Is it safe to assume that the data is available in "real time" Also if a user logged in to the DB drops his connection by doing something stupid like powering off his workstation without closing the app first, will the count be reduced, the next time it is run
  • MarkInNB

    This query will give you a count grouped by DB, you can also use sp_who or sp_who2

    select db_name(dbid),count(*) from master..sysprocesses
    where spid > 49 --everyting below 50 is SQL Server itself
    group by db_name(dbid)

    Denis the SQL Menace

    http://sqlservercode.blogspot.com/


  • Determining the number of Active users logged into a SQL Server Database