SQL Server Admin
T-SQL Articles

February 02, 2008

How to find out the users logged in to a SQL Server 2005 database




In order to find out the users logged in to a database, use the system view called sys.sysprocesses.

select * from sys.sysprocesses

returns you a host of information about the login name, Windows user name, processes running on an instance of SQL Server etc.. Check out the hostname, nt_username, loginame, nt_domain columns returned on executing the above query.

Read more about sys.sysprocesses over here

http://msdn2.microsoft.com/en-us/library/ms179881.aspx

You can also try out the stored procedures sp_who

EXEC sp_who

EXEC sp_who2

sp_who provides information about current users, sessions, and processes in an instance of SQL Server


Did you like this post?
kick it on DotNetKicks.com
subscribe via rss subscribe via e-mail
print this post follow me on twitter



 
  Feedback:

comments

0 Responses to "How to find out the users logged in to a SQL Server 2005 database"
 

Copyright © 2009-2011 All Rights Reserved for SQLServerCurry.com by Suprotim Agarwal | Terms and Conditions