Toon posts:

Get SQL-server concurrent users from one db

Pagina: 1
Acties:

Verwijderd

Topicstarter
?.......

Can somebody tell me how i can get de amount off concurrent user who have a connection to one specific database on SQL-Server?

What I had until now is:
*********************************************************
Select l.xstatus, l.name, db.name
From [master].[dbo].sysxlogins as l, [master].[dbo].sysdatabases as db
Where l.dbid = db.dbid and db.name = 'tempDB'
*********************************************************

But with this I did not get the right result, because the sleeping users come also in the result.

Who can help me??

Thx!
_RayDance_

Verwijderd

Topicstarter
After a lot of reading I did make a solution for myself, see below:

Select Amount = count(distinct(prc.hostname))
From [master].[dbo].sysprocesses as prc, [master].[dbo].sysdatabases as as db
Where prc.Hostname <> '' and prc.dbid = db.dbid and db.name = 'TempDB'

Pherhaps u'll need it sometime!

Greetz _RayDance_