The SAP ASE server allows you to treat square brackets individually in the like pattern-matching algorithm.
select * from t1 where f1 like '[[]XX[]]'
select * from t1 where f1 like '[[]XX]'
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 SAP ASE earlier than 15.7.
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 |
---|---|
“[[]” |
“[” |
“[]]” |
“]” |
“]” |
“]” |
“[[]XX]” |
“[XX]” |
“[[]XX[]]” |
“[XX]” |