how to know number of connections in active mode

Hi experts,

how to know number of connections active with database ,  how to maintain less number of  connections with database . i am using sqlsever 2005
gpinfotechAsked:
Who is Participating?
 
DhaestCommented:
When I execute this query on my database, I get 51 rows (grouped by database), with some have a connection of 51 users, while others only have 0.

If you only want to have the connections, without knowing to which database, you can use this
SELECT count(dbid) as NoOfConnections
FROM sys.sysprocesses
WHERE dbid > 0

(you can add filters on the status fe)
0
 
DhaestCommented:
You can run a query on your system to see how many active connections there are

How to see active connections for each Database in SQL Server 2005
http://www.sqlservercurry.com/2008/03/how-to-see-active-connections-for-each.html
SELECT db_name(dbid) as DatabaseName, count(dbid) as NoOfConnections,
loginame as LoginName
FROM sys.sysprocesses
WHERE dbid > 0
GROUP BY dbid, loginame

Open in new window

0
 
gpinfotechAuthor Commented:
i want to know active connections with sqlserver when i am using asp.net webapplication. when i am using above query always it is showing one connection only!
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
DhaestCommented:
Did you check the NoOfConnections in asp.net when you run the query ?

Try this (without the username):

SELECT db_name(dbid) as DatabaseName, count(dbid) as NoOfConnections,
FROM sys.sysprocesses
WHERE dbid > 0
GROUP BY dbid
0
 
gpinfotechAuthor Commented:
now also i am getting one connection only !
0
 
gpinfotechAuthor Commented:
Hi thank u for ur reply
0
 
Amandeep Singh BhullarCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.