The patindex is checking for two chars _ and space
charindex('_', @a) will return position of first _ char
patindex('%[ _]%', @a) will return position of EITHER _ or space
charindex('_', @a) and patindex('%[_]%', @a) would give the same result (ie no space)
if checking for presence of _ and space then
CHARINDEX('_', @a) > 0 AND CHARINDEX(' ', @a) > 0
would be the same as
PATINDEX('%[ _]%', @a) > 0
and it would get worse if you wanted to check for the letters a to f as you would have to OR 6 CHARINDEX
or use PATINDEX('%[a-f]%', @a)
Far away is close at hand in the images of elsewhere.
Anon.