Adaptive Server 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]'
Because of the need for full compatibility, this feature is available only in Adaptive Server version 15.7 and later by enabling the command:
sp_configure “enable functionality group”, 1
If you do not enable this feature, the behavior of like pattern-matching for square brackets is as in versions of Adaptive Server earlier than 15.7.
When you enable this feature:
like pattern-matching
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 that work when you enable this feature are:
Pattern |
Matches |
---|---|
“ |
“ |
“ |
“ |
“ |
“ |
“ |
“ |
“ |
“ |