Link to home
Create AccountLog in
Avatar of saratcm
saratcmFlag for India

asked on

How to track which users logged in to sql server

Hi All,
How to track which users logged in to sql server?
do they need to have only windows login to track them or sql logins to will work to track them?
Avatar of avalenzuela
avalenzuela
Flag of Mexico image

use
   select * from sys.sysprocesses

it will list all process and what users are connected
ASKER CERTIFIED SOLUTION
Avatar of avalenzuela
avalenzuela
Flag of Mexico image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of saratcm

ASKER

Thanks for the comments, will this give information only for the users who r currently logged in or also for  currently logged off of or users no longer in that session( disconnected)?
I mean in case if I want to find out which user logged in in last 30 min or so and they might have closed their session by the time I am executing this cmd
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
I would use SQL Profiler and build traces that would track audit login and logoff events.

There is a great topic on this at http://msdn.microsoft.com/en-us/library/aa905160(SQL.80).aspx
Avatar of saratcm

ASKER

Thanks