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
 General SQL Server Forums
 New to SQL Server Programming
 How to know How many connections are Open+sql serv

Author  Topic 

vedjha
Posting Yak Master

228 Posts

Posted - 2008-08-30 : 09:07:39
How to know How many connections are Open+sql server 2000
what is syntax

Ved Prakash Jha

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-08-30 : 13:25:40
select count(*) from sysprocesses where spid>50

Session IDs (spid) less than or equal to 50 are system processes and hence aren't connections.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-08-30 : 13:36:53
What about SPID 50 then?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

vedjha
Posting Yak Master

228 Posts

Posted - 2008-08-31 : 02:31:28
when i a m using locally in Sql 2000 it returns 1
but in online sql2005 it gives an error as:

Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'sysprocesses'.


Ved Prakash Jha
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-08-31 : 05:27:42
You said SQL 2000. Hence the solution was for SQL 2000.

For 2005 you can either use the same query, replacing sysprocesses with master..sysprocesses, or you can use this:
select count(*) from sys.dm_exec_connections

--
Gail Shaw
SQL Server MVP
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-08-31 : 05:28:41
quote:
Originally posted by Peso

What about SPID 50 then?



Better now?

--
Gail Shaw
SQL Server MVP
Go to Top of Page

vedjha
Posting Yak Master

228 Posts

Posted - 2008-08-31 : 07:13:37
I have not permission to view result in online
Actually My website is running on net .
some times connection problem comes.
so i want to see that how many connections are open .
and it is clossing or not.
so please guide me how to do

Ved Prakash Jha
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-08-31 : 12:28:56
I've said how to see how many connections are currently open to SQL. Is that what you're after or does it not help you? If it doesn't help, why?

What do you mean by "and it is clossing or not"? If you're trying to see if a connection is going to close, there's no way for SQL to tell that. It can't know what the application is going to do.

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -