Tuesday, November 12, 2013

LIKE Function

The table provides some additional functionality of LIKE function


Wildcard
Meaning
Example
% (percent sign)
Any string including an empty one
‘D%’ : string starting with D
_ (underscore)
A single character
‘_D%’ : string where second character is D
[<character list>]
A single character from a list
‘[AC]%’ :  string where first character is A or C
<character range>]
A single character from a range
‘[0-9]%’ : string where first character is a digit
<^<character list or range>]
A single character that is not in the list of range
‘[^0-9]%’ : string where first character is not a digit


If you want to look for a character that is considered a wildcard, use the escape ‘!’ character before the wildcard character.
Ex:
‘!_%’ à starting from _

‘!*%’à starting *

No comments:

Post a Comment