Connections per db

  • Could someone help me out on reporting the user connections count per db? If possible I would like the following to also show the dbname from 'sysdatabases'. This way I would get db ID, db name & connections.

    SELECT dbid,Count(*)

    FROM   master..sysprocesses

    WHERE  spid > 50

    group by dbid

    Rgds,

     

  • You mean like this?

    SELECT p.dbid, d.[name], Count(*)

    FROM   master..sysprocesses p

    JOIN master..sysdatabases d ON d.dbid = p.dbid

    WHERE  spid > 50 

    GROUP BY p.dbid, d.[name]

  • and also like this ?

     

    SELECT dbid,db_name(dbid),Count(*)

    FROM   master..sysprocesses

    WHERE  spid > 50

    group by dbid

  • Just great! Simpel if you know how to

    Thanks Guys!

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

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