This has probably been asked 100's of times but I am new to sql server.
I need to know how many users are currently logged on to my database so that
i can display this value on a vb form.
i am using sql server 6.5 and vb6. sp_who nearly does what i want but i
can't limit the rows just to my database
Any help would be much appreciated
Dave Lownds
HEBS
Below is for the pubs database:
--Number of connections
SELECT COUNT(*) FROM master..sysprocesses WHERE dbid = db_id('pubs')
--Number of users, first is 7.0, second is 6.x
SELECT COUNT(DISTINCT sid) FROM master..sysprocesses WHERE dbid =
db_id('pubs')
SELECT COUNT(DISTINCT suid) FROM master..sysprocesses WHERE dbid =
db_id('pubs')
--
Tibor Karaszi, ti...@cornerstone.se
MCSE, MCSD, MCT, SQL Server MVP
Cornerstone Sweden AB
Please do not respond by e-mail unless explicitly asked for.
David Lownds wrote in message <#wZtPiVc#GA.204@cppssbbsa03>...
Tibor Karaszi wrote in message ...