sp_who is used to list all the users connected to sql server
It will list out the current process id, login user name, process through which the user gets connected, connected time, duration, Details database accessed by the user, login user role.
Difference between sp_who and sp_who2:
Both will perform the same operation, sp_who2 will give additional performance related information like
CPU time
Disk I/O
SPID
There is an alternative way to retrieve the result set. We can achieve it by accessing the system tables too,
select* from master.dbo.syslogins
Regards,
Venkatesan Prabu . J
Hi, Venkatesan.
ReplyDeleteMy name is Sérgio and I'm from Brazil. I read your article about how to get the list of connected users.
Does the system table syslogins returns the connected users or the list of all logins?
Did you mean sysprocesses? Either way, I need to know if there are APIs in the .NET framwork that connect to the DB and get the list of all connected users? Can you help me?
Thanks in advance.
[]'s
Sérgio
sorry for the delayed reply..
ReplyDeleteYup, syslogins will retrieve all the login users available currently.
No we dont want any API instead you can use an ordinary sql query to fetch the data from .net
Thanks,
Venkatesan prabu .J