Thursday, March 22, 2012

count active connections

Hi,

Does anybody know how I could count current active connections on a database?

For exemple, currently, if I want to see how many connections are opened on a specific DB, I try to detach the DB, then it tells me how many active connections are opened on it; I just don't know where to get this information with my own script, a kind of:

SELECT NB_ACTIVE_CONNECTION ON [MY_DB]

Thanks for your help!try doing something with sp_who|||Thanks, I get a resultset. Too bad I don't have access to sp_who source code do custom my own stored proc.

Thanks again!|||Of course you have access to the sp_who source code. Just to a sp_helptext sp_who, in master. This will display the source code. You can copy it and create your own. Just don't call it sp_who. You can call it sp_MyWho.|||of course you could just query master.dbo.sysprocesses|||achorozy: Your so much right, I guess I need holidays, I completly forgot about master! The best is I often go on it to catch some scripts. Bang bang on my head!

paul young: I have to check this, never tried it.

Thanks all of you for helping.sql

No comments:

Post a Comment