How to find rows containing a character '%' in a table column.
'%'
For example, I have a column that contains data like 'amylase 50% of dose' .
'amylase 50% of dose'
How do I select and filter all rows containing a character % in a given column?
%
try this query
select * from tablename where columnname like '%[%]%'
You can use WHERE Id LIKE '%[%]%' . An example would be something like this:
WHERE Id LIKE '%[%]%'
CREATE TABLE #Test ( Id NVARCHAR(100) ) INSERT INTO #Test VALUES ('100%'), ('1000') SELECT * FROM #Test WHERE Id LIKE '%[%]%' DROP TABLE #Test
OUTPUT:
Id 100%
We use the clause / operator to find / match anything in the columns. Below query will look for "%" at start / middle / end or can say everywhere in the column value.
select * from tablename where columnname like '%[%]%'.
Try the following,
select * from tablename where columnname like '%\%%'