1

I want to search and select columns where there is a single quote (') present in the text using LIKE or CONTAINS Predicate.

consider the following text : 10011-RIO MARE EXTRA'

Akhil George
  • 13
  • 1
  • 1
  • 4

4 Answers4

2
CREATE TABLE #TEST
( Test_Column  VARCHAR(MAX));

INSERT INTO #TEST VALUES
('10011-RIO MARE EXTRA''')

SELECT * 
FROM #TEST
WHERE Test_Column LIKE '%''%'

The escape character for ' is ' used twice -> ''.

Andrzej M.
  • 92
  • 3
1

try this

select * from yourtable where youcolumn like '%''%'
Esperento57
  • 16,521
  • 3
  • 39
  • 45
1

Find records with single quotes in the table

SELECT *
FROM [tableName]
where Name like '%''%'   
WhatsThePoint
  • 3,395
  • 8
  • 31
  • 53
Manish Kumar
  • 201
  • 2
  • 2
-1

I hope this solves your problem

% ' % -> Finds any values that have " ' " in any position

By executing below query you will get the result which have '(single quote) in them

SELECT * FROM TABLE_NAME WHERE COLUMN_NAME LIKE "%'%"

i have executed the same query enter image description here