:::: MENU ::::

Read SQL Server Error log info through T-SQL

  • Nov 12 / 2008
  • 0
dbDigger, Monitoring and Analysis, System Stored Procedures

Read SQL Server Error log info through T-SQL

SQL Server Management studio (SSMS) and SQL Server Enterprise Manager provide a good interface for listing error log file archives and reading each error log archive individually. But I have noticed that when log file entries grow in number. SSMS/SSEM take some time to load the log file content. So how to get list of error log archives through T-SQL and how to list log contents of an error log file through T-SQL. Following two commands will help you in this regard.

exec sp_enumerrorlogs

Error log Archives

And to read log content of log archive file # 1, I have used following command.

exec sp_readerrorlog 1

The parameter 1 is to point the log archive file number. You may give file number from 0 to 6 as provided in list.

Error log Archives contents

Consult us to explore the Databases. Contact us