Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 How to get number of connection for each db

Author  Topic 

chih
Posting Yak Master

154 Posts

Posted - 2007-08-02 : 22:50:12
Hi everyone,

We can use active monitor to see all connections to our db server.
however, is there a query I can apply to see current number of connection for each db in overall?

for example
|db | coonection|
master 100
member 200


Master..sysprocesses doesn't provide db_name

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-02 : 22:59:47
Try this:

select db_name(dbid) as db, count(dbid) as connection from sys.sysprocesses where dbid > 0 group by dbid
Go to Top of Page

chih
Posting Yak Master

154 Posts

Posted - 2007-08-03 : 00:10:23
Thank you very much!!

quote:
Originally posted by rmiao

Try this:

select db_name(dbid) as db, count(dbid) as connection from sys.sysprocesses where dbid > 0 group by dbid

Go to Top of Page
   

- Advertisement -