Reputation: 612
I have to select all rows from a table where column (varchar) values contain '%' in the text. I tried below query but failed to get correct result set.
SELECT * from TABLE where VALUE LIKE '%%%'
Above query gives all rows of the table.
Please help me to form a query to match '%' and get the correct results.
Upvotes: 0
Views: 41
Reputation: 612
Escape character worked for me.
SELECT * from TABLE where VALUE LIKE '%\%%'
This query gives me correct result set.
Upvotes: 0
Reputation: 204746
SELECT * FROM your_table
WHERE value LIKE '%\\%%'
Upvotes: 1