• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 383
  • Last Modified:

Current connections to Server

I'm trying to see how many open connections to my databases there are from my web pages.

I have over a 120 intranet users of which at least 80% are connected and working at any moment.

My attached code however ALWAYS only returns one connection...to a single database
I know that can't be correct there are at least 6 databases in use at any moment as well.

Any suggestions?
SELECT DB_NAME(dbid) as 'DbName', COUNT(dbid) as 'Connections' 
   from master.dbo.sysprocesses with (nolock)
   WHERE dbid > 0 and DB_NAME(dbid) not in ('master','msdb')
   GROUP BY dbid

Open in new window

Larry Brister
Larry Brister
2 Solutions
sp_who2 'Active'
I just executed the query and looks like it returns me all the connections. Please try to execute the below queries and analyse the data, you should see more details of what processes are currently accessing the databases.
  select * from master.dbo.sysprocesses
Larry Bristersr. DeveloperAuthor Commented:
You're both correct.
This is a permissions issue...it runs fine on the DEV server...but not the live one.

I'll have to track it down
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.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now