Tag Archives: Extended Procedures

How to read error log using T-SQL?

xp_enumerrorlogs
This extended stored procedure returns the list of all error logs with their last change date and size. To get the list of error logs, run:

XP_ReadErrorLog: You can execute below query to read the error log. You can read the archive file by giving the number as per the output of xp_enumerrorlogs command.  If you will not specify any file number it will open the current error log file.

EXEC sys.xp_readerrorlog @p1

@p1 = file number you want to read.