Chapter 4: Expressions, Identifiers, and Wildcard Characters
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.
Table 4-8 shows
examples of square brackets used as escape characters with like.
Table 4-8: Using square brackets to search for wildcard characters
like predicate
|
Meaning
|
like "5%"
|
5 followed by any string of 0 or more
characters
|
like "5[%]"
|
5%
|
like "_n"
|
an, in, on (and so on)
|
like "[_]n"
|
_n
|
like "[a-cdf]"
|
a, b, c, d, or f
|
like "[-acdf]"
|
-, a, c, d, or f
|
like "[[ ]"
|
[
|
like "]"
|
]
|
like “[[]ab]”
|
[]ab
|
Copyright © 2005. Sybase Inc. All rights reserved.
|
|
View this book as PDF