Tag Archives: Read Error Log

How to search error from SQL Server error log or SQL Server Agent Log?

How to search error from SQL Server error log or SQL Server Agent Log?

We can find the particular error or information from error log by passing below parameters to XP_ReadErrorLog extended procedure.


EXEC 
sys.xp_readerrorlog @p1,@p2,@p3,@p4

@P1 = Value of error log file you want to read: 0 = current, 1 = Archive #1, 2 = Archive #2, etc…

@P2 = Log file type: 1 or NULL = error log, 2 = SQL Agent log

@P3 = Search string 1: String one you want to search for

@P4 = Search string 2: String two you want to search for to further refine the results

Please note all the parameters are optional.