Skip to content

Instantly share code, notes, and snippets.

@ronascentes
Last active November 29, 2016 17:34
Show Gist options
  • Save ronascentes/2c522876b4accca6e96d4b9d1699e126 to your computer and use it in GitHub Desktop.
Save ronascentes/2c522876b4accca6e96d4b9d1699e126 to your computer and use it in GitHub Desktop.
Look for usually errors by using xp_readerrrorlog
/*
xp_readerrrorlog - extended stored procedure accepts at least 7 parameters
Value of error log file you want to read: 0 = current, 1 = Archive #1, 2 = Archive #2, etc...
Log file type: 1 or NULL = error log, 2 = SQL Agent log
Search string 1: String one you want to search for
Search string 2: String two you want to search for to further refine the results
Search from start time
Search to end time
Sort order for results: N'asc' = ascending, N'desc' = descending
EXEC xp_readerrorlog 0, 1, NULL, NULL, NULL, NULL, N'desc'
*/
EXEC xp_readerrorlog 0, 1, NULL, NULL, NULL, NULL, N'desc'
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment