What is the complete list of all special characters for a SQL (I’m interested in SQL Server but other’s would be good too) LIKE clause?
E.g.
SELECT Name FROM Person WHERE Name LIKE '%Jon%'
- %
- _
- [specifier] E.g. [a-z]
- [^specifier]
- ESCAPE clause E.g. %30!%%’ ESCAPE ‘!’ will evaluate 30% as true
- ‘ characters need to be escaped with ‘ E.g. they’re becomes they”re
%– Any string of zero or more characters._– Any single character- ESCAPE clause E.g. %30!%%’ ESCAPE ‘!’ will evaluate 30% as true
%– Any string of zero or more characters._– Any single character- ESCAPE clause E.g. %30!%%’ ESCAPE ‘!’ will evaluate 30% as true
Sybase
- %
- _
- [specifier] E.g. [a-z]
- [^specifier]
%– Any string of zero or more characters._– Any single character Reference Guide here [PDF]
%– Any string of zero or more characters._– Any single character- ESCAPE clause E.g. %30!%%’ ESCAPE ‘!’ will evaluate 30% as true
- %
- _
- An ESCAPE character only if specified.
PostgreSQL also has the SIMILAR TO operator which adds the following:
[specifier][^specifier]|– either of two alternatives*– repetition of the previous item zero or more times.+– repetition of the previous item one or more times.()– group items together
The idea is to make this a community Wiki that can become a “One stop shop” for this.
whoah this blog is wonderful i really like reading your articles. Keep up the great paintings! You realize, a lot of people are hunting round for this info, you could help them greatly.