简体   繁体   中英

Using wildcards

Can anyone help me out with this-

There is a column in the database as "TEXT". This column hold some string value. I want to search any row that is having '%' in this column .

For eg how will i search for a row having value 'Vivek%123' in the column TEXT

您必须转义%字符

WHERE COL1 LIKE 'Vivek@%123' ESCAPE '@' ;

In sql there is something known as an escape character, basically if you use this character it will be ignored and the character right behind it will be used as a literal instead of a wildcard in the case of %

WHERE Text LIKE '%!%%'
ESCAPE '!' 

The above sql statement will allow you to search for any string containing a percentage character '%' so it could find anything in the format of

string%string

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM