简体   繁体   中英

SQL Server : find last time user was connected

I have a SQL Server (2000) with a number of accounts which I think are no longer used. Is there any way I can find out when each account was last used?

Alternatively what is the easiest way to create a table of accounts logging on to the server over a period.

SQL Server can audit logins. Read more detail here for SQL 2008 and here for SQL 2000

I do not think you can track login usage unless the auditing is turned on.

If the user is listed under the folder "Security"-->"Logins", this query will give you the last date/time that user signed in.

select name, accdate from sys.syslogins order by 1

NOTE: This only works for those IDs that currently exist in the SQL database. If the ID was deleted, it will not appear on the list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM