SELECT * FROM my_table WHERE some_column LIKE '%\%%' ESCAPE '\';The query above defines the backslash as an escape character so that it will search for any row that has a percent sign in some_column.
Thursday, December 18, 2008
How to search for a percent (%) sign in a like query
The percent (%) sign in a SQL LIKE query is used as a wildcard. If you need to look for text containing a percent (%) sign, then you'll have to use an escape character to specify that the SQL database should look for an actual percent sign. The query below is an example of how to do this:
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment