Wednesday, March 21, 2012

number of connections

How can I know the number of open connections to a database from a client application (via ADO)?To find out how many users are connected:

select count(*)
from master..sysprocesses
where uid <> 1

The 'uid <> 1' excludes system connections.|||select count(*)
from master..sysprocesses
where dbid = db_id('dbname')
and hostname = 'appname'

You will have to check the hostname in sysprocesses to find how the application connects.
You can also log all connects and disconnects to a table or text file using the profiler.

No comments:

Post a Comment