3

I need to find % in a column. I tried the following

SELECT  *
FROM    <table>
WHERE   <column> LIKE '%%%'

But, all rows are listed. How to find the rows only with % using LIKE condition?

Jesuraja
  • 3,774
  • 4
  • 24
  • 48

3 Answers3

7

Try following format:

select  * 
FROM    <table>
WHERE   <column> LIKE '%/%%' ESCAPE '/'

You can also use %[%]% in your like: Anand Answer

Community
  • 1
  • 1
mehdi lotfi
  • 11,194
  • 18
  • 82
  • 128
7

This may be appropriate:

select  * 
FROM    <table>
WHERE   <column> LIKE '%[%]%'
Recursive
  • 954
  • 7
  • 12
0

Try to use \ to escape the percentage. Try the following:

select * from table where column like '%\%%';
BatAnna
  • 19
  • Note that the tag SLQ Server was added to the question after. Jesuraja, you should not ping the person trying to help you for your failing. BatAnna cannot comment to you. – smoore4 Jul 22 '14 at 07:34
  • @BatAnna Did you try? Is it working? Which version? It is not at all working. – Jesuraja Jul 22 '14 at 07:42