Adaptive Server version allows you to treat square brackets individually in the like pattern-matching algorithm.
For example, matching a row with ‘[XX]’ in earlier versions of Adaptive Server required you to use:
select * from t1 where f1 like '[[]XX[]]'
However, you can also use:
select * from t1 where f1 like '[[]XX]'
When you use like pattern-matching:
It allows a closing square bracket (“]”)
immediately following an opening bracket (“[”)
to stand for itself, so that the pattern “[]]” matches
the string “]”.
An initial caret (“^”) inverts the sense in all character ranges, so that the pattern “[^]]” should match any single character string that is not “]”.
In any other position, the closing bracket (“]”)
marks the end of the character range.
The patterns and matches for like pattern-matching are:
Pattern |
Matches |
|---|---|
“ |
“ |
“ |
“ |
“ |
“ |
“ |
“ |
“ |
“ |