Link to home
Create AccountLog in
Avatar of rborda
rbordaFlag for United States of America

asked on

How to obtain some fields out of the security log created by SQL Server

Thank you in advance for any input,

I need two get only the user and the date out of the "security log" that shows user's logon/logoff data.
This log is found under Management\SQL Server Logs\Current... then there are several Archives.
The following two selects does not provide me with the same information that the log contains:

select * from sys.server_principals
select * from sys.database_principals
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg 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
you might however want to check out this script:
http://www.databasejournal.com/img/sp_import_errorlog.sql

using this stored procedure:
EXEC sp_readerrorlog @log_number