Using Square Brackets ( [ ] ) as Escape Characters

Use square brackets as escape characters for the percent sign, the underscore, and the left bracket. The right bracket does not need an escape character; use it by itself. If you use the hyphen as a literal character, it must be the first character inside a set of square brackets.

Examples of square brackets used as escape characters with like are:

Using Square Brackets to Search for Wildcard Characters

like predicate


like "5%"

5 followed by any string of 0 or more characters

like "5[%]"


like "_n"

an, in, on (and so on)

like "[_]n"


like "[a-cdf]"

a, b, c, d, or f

like "[-acdf]"

-, a, c, d, or f

like "[[ ]"


like "]"


like “[[]ab]”