473,394 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Getting Number of Logged On Users to Server

SQL Server 2000 - MSDE 2000

Is there a way to get the number of current users logged into a SQL 2000 Server (also MSDE)? Cant be distinct users as most users are logged into the database using the same login.

--
Tim Morrison

--------------------------------------------------------------------------------

Vehicle Web Studio - The easiest way to create and maintain your vehicle related website.
http://www.vehiclewebstudio.com
Jul 20 '05 #1
4 17602
Tim Morrison (sa***@kjmsoftware.com) writes:
SQL Server 2000 - MSDE 2000

Is there a way to get the number of current users logged into a SQL 2000
Server (also MSDE)? Cant be distinct users as most users are logged into
the database using the same login.


select count(*) from master..sysprocesses where spid > 50 will give you
a rough number. This will include logins from SQL Agent. Note that the
same user can be using multiple connections from the same application,
and thus be counted more than once.

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2
hmmm..... thanks for the info. Im surprised there isnt a more definate way
to get this information from SQL.

Tim Morrison

"Erland Sommarskog" <so****@algonet.se> wrote in message
news:Xn*********************@127.0.0.1...
Tim Morrison (sa***@kjmsoftware.com) writes:
SQL Server 2000 - MSDE 2000

Is there a way to get the number of current users logged into a SQL 2000
Server (also MSDE)? Cant be distinct users as most users are logged into
the database using the same login.


select count(*) from master..sysprocesses where spid > 50 will give you
a rough number. This will include logins from SQL Agent. Note that the
same user can be using multiple connections from the same application,
and thus be counted more than once.

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp

Jul 20 '05 #3
I see that one of the fields is "program_name" in the sysprocesses table. I
have Crystal Reportsrunning so that is one of the processes. How do I get my
app to report itself as one of those processes like crystal?

Then I can do a 'SELECT count(*) FROM sysprocesses WHERE program_name =
'MyApp'.
TIA

Tim Morrison
"Erland Sommarskog" <so****@algonet.se> wrote in message
news:Xn*********************@127.0.0.1...
Tim Morrison (sa***@kjmsoftware.com) writes:
SQL Server 2000 - MSDE 2000

Is there a way to get the number of current users logged into a SQL 2000
Server (also MSDE)? Cant be distinct users as most users are logged into
the database using the same login.


select count(*) from master..sysprocesses where spid > 50 will give you
a rough number. This will include logins from SQL Agent. Note that the
same user can be using multiple connections from the same application,
and thus be counted more than once.

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp

Jul 20 '05 #4
You can specify it in the connection string, something like "Application
Name = etc" Its documented in the ADO/OLE DB/ODBC connection strings
documentation.
"Tim Morrison" <sa***@kjmsoftware.com> wrote in message
news:CxQyb.381793$HS4.3135751@attbi_s01...
I see that one of the fields is "program_name" in the sysprocesses table. I have Crystal Reportsrunning so that is one of the processes. How do I get my app to report itself as one of those processes like crystal?

Then I can do a 'SELECT count(*) FROM sysprocesses WHERE program_name =
'MyApp'.
TIA

Tim Morrison
"Erland Sommarskog" <so****@algonet.se> wrote in message
news:Xn*********************@127.0.0.1...
Tim Morrison (sa***@kjmsoftware.com) writes:
SQL Server 2000 - MSDE 2000

Is there a way to get the number of current users logged into a SQL 2000 Server (also MSDE)? Cant be distinct users as most users are logged into the database using the same login.


select count(*) from master..sysprocesses where spid > 50 will give you
a rough number. This will include logins from SQL Agent. Note that the
same user can be using multiple connections from the same application,
and thus be counted more than once.

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp


Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Marcin Zmyslowski | last post by:
Hello all! I want to create a page in ASP language which gives me information about currently logged users. I thought to do it by this way: when somebody will log in to page, there will be a...
3
by: Rod | last post by:
Today and tomorrow we're demonstrating our ASP.NET application to the external business customers who will be using it (this is what would best be called a B2B application). I've set things up so...
0
by: roh | last post by:
Hello Friends, We are developing a web based application using DB2 UDB Ver 8.1 FixPack7 and Web Sphere Application Server 6.0. We are facing following issue: When number of users logged into...
1
by: Smalley | last post by:
Need some help please. Have this code and for some reason it is not working correctly. I am not receiving errors, just the table is not being populated at all. I have created the tbl and the frm...
6
by: krvrk | last post by:
Hi, I am creating a report for which i need to query a table for total number of users and Concurrent users logged in. The table will contain Username(nvarcar,not null),SessionStart...
2
BradHodge
by: BradHodge | last post by:
Reading a post regarding network security on a linked database, I saw this post by PDog on number of users in a network Environment... I am about to put a very small database (2200 kb back-end)...
8
by: Mike P | last post by:
What would be the best way of counting the number of users who are currently logged on to a website? I am making the users login against a database of valid users. Would the best way be to add a...
5
by: Jonathan Wood | last post by:
Greetings, I'm using ASP.NET membership and I'd like to query the number of users in a particular role. I don't want the overhead of returning a dataset and then getting the number of items...
13
by: snowinfo | last post by:
Hi all, any way to count the number of users i have logged into my site? any help/code appreciated, craig
4
by: rahullko05 | last post by:
Hi, I am writing a code to display the number of user currently viewing my website at any point of time. for example: for bytes i can see network: 216355 as number of users currently viewing...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.