MCITP

MCITP

Monday, January 12, 2015

XP_READERRORLOG parameters


sp_readerrolog accepts 4 parameters

The extended stored procedure accepts 7 parameters.

If this extended stored procedure is called directly the parameters are as follows:

  1. # error log file to read: 0 = current, 1 = Archive #1, 2 = Archive #2, etc...
  2. Log file type: 1 or NULL = error log, 2 = SQL Agent log
  3. Search string 1: String one you want to search for
  4. Search string 2: String two you want to search for to further refine the results
  5. Search from start time
  6. Search to end time
  7. Sort order for results: N'asc' = ascending, N'desc' = descending

To search with string (Error, 112)

EXEC xp_readerrorlog 0, 1, '2005', 'exec', NULL, NULL, N'desc'

To search with datetime range:

EXEC xp_readerrorlog 0, 1, null, null, startdate,enddate

EXEC xp_readerrorlog 0, 1, null, “error”, '2015-01-09 00:38:49.460','2015-01-09 23:38:49.460’

No comments:

Post a Comment