findstr—Strings to Find

In the first approach, you build a list of strings that define errors you want findstr to match. This list of strings can be supplied as an input file to the Findstr.exe file.

For example, say you want to find any occurrences of the strings "table corrupt," which accompanies many serious data errors, and "msg 605," which is a specific type of error. Place these strings into a file, called Search.txt, like this:

table corrupt
msg 605

Run Findstr.exe on the DBCC output files using the following syntax where Dbcc.* matches a group of DBCC output files to search, and Findstr.out is where the search results are placed:

findstr /i /g:search.txt dbcc.* > findstr.out

The challenge with this approach is knowing ahead of time what error strings to search for. Unfortunately, there is no comprehensive list of SQL error strings that encompasses all possible DBCC, server, and kernel errors. However, searching for the following strings provides fairly good coverage as a starting point:

level 16
Severity: 17
level 17
Severity: 18
level 18
Severity: 19
level 19
Severity: 20
level 20
Severity: 21
level 21
table corrupt
Severity: 16


Using a little experimentation, it is usually possible to further refine this and get fairly reliable checking.