Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding Rows containing % symbol in a table [duplicate]

Tags:

sql

sql-server

How to find rows that contains '%' symbol in a column of table.

For example, I have a column containing data as 'amylase 50% of dose'.

How to select and filter all the rows containing % symbol in a given column?

like image 328
Nazeer_hanne Avatar asked Sep 06 '25 03:09

Nazeer_hanne


2 Answers

try this query

select * from tablename where columnname like '%[%]%'
like image 86
Mukesh Kalgude Avatar answered Sep 07 '25 23:09

Mukesh Kalgude


You can use WHERE Id LIKE '%[%]%'. An example will be something like this:

CREATE TABLE #Test
(
Id NVARCHAR(100)
)

INSERT INTO #Test VALUES ('100%'), ('1000')

SELECT * FROM #Test
WHERE Id LIKE '%[%]%'

DROP TABLE #Test

OUTPUT:

Id
100%
like image 32
Stanislovas Kalašnikovas Avatar answered Sep 07 '25 23:09

Stanislovas Kalašnikovas