Thursday, March 8, 2012

Auditing a SQL user's Login activity

I have a database on my SQL 2000 server called Test. I have a SQL user accou
nt called Bob. I am trying to run a query against the Test database to see w
hen the last time Bob accessed the database. I did a google search and came
up with the following:
select UserName, LastLoggedIn = max(LoggedIn)
from {InsertYourTableName}
group by UserName
order by UserName
This seems to be at the Table level, not the database level. So then I tried
running SQL profiler, but before I waste too much time on Profiler, I was h
oping that someone could point in the right direction. Thanks.It appears that you would run the query after collecting the data using SQL
Profiler.
SQL Profiler can be configured to put the data it captures in a SQL table.
So, this sample code appears
to query the table.
This is not a query on the System tables. We don't capture this info by
default.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.

No comments:

Post a Comment