Blog Pages

xp_ReadErrorLog - Get records from the SQL Server log

xp_ReadErrorLog [number of the log file], [SQL error logs/Agent logs], [search string 1], [search string 2]
  • Parameter 1 (int), is the number of the log file you want to read. The default value is 0 for the current log. 
  • Parameter 2 (int), value of 1 reads SQL error logs, value of 2 reads SQL Server Agent logs. The default value is 1.
  • Parameters 3 and 4 (varchar (255)), are search strings for the log entry. The default value is NULL.
Note for parameter 1: To get the list of archive files, use xp_enumerrorlogs:

No comments:

Post a Comment