This is a discussion on finding active users from sysprocesses within the SQL Server forums, part of the Microsoft SQL Server category; --> I am trying to find a select on sysprocesses that would list all the active logins. An active login ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I am trying to find a select on sysprocesses that would list all the active logins. An active login is a login that has a TSQL statment being executed on the server, This didnt work to well! Any ideas. Thanks in advance. select sp.loginame, -- more columns from master..sysprocesses sp where sp.status not in ('sleeping','background' ) order by 1 |
| ||||
| kr (zzb26 (at) email.com) writes: > I am trying to find a select on sysprocesses that would list all the > active logins. An active login is a login that has a TSQL statment being > executed on the server, > > This didnt work to well! Any ideas. Thanks in advance. > > select sp.loginame, > -- more columns > from master..sysprocesses sp > where sp.status not in ('sleeping','background' ) > order by 1 In which way did it not work? In any case, you definitely want to add "or opentrn > 0". A process which has a open transaction is active, even if it is sleeping. I have a lock-monitoring routine, and the condition I use is upper(p.cmd) <> 'AWAITING COMMAND' I also check whether sysprocesses.blocked > 0. -- Erland Sommarskog, SQL Server MVP, sommar@algonet.se Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp |