SQL can't search for '' (double quotes or two apostrophe) but successfully search for " quotation marks) within a text

Why can't SQL find for results including double quotes however it successfully return results if quotation marks is included.

Double Quotes or two apostrophe ('') Ex: 'Dell 27'' Monitor'
Quotation Marks (") Ex: 'Dell 27" Monitor'

SELECT *
FROM tblProducts
WHERE ProductName LIKE (N'Dell 27'' Monitor')

Hi

Please look for concept of escape characters

also i think double quotes is reserved by SQL Server

@harishgg1
Do you have any good article link to read and any solution to this problem.

I found an microsoft article which allows to supass that escape problem.

I am not very experienced in SQL if you can look at this article and help me if this could be a solution?
Thanks

ok i can do it

give me a sec

hi

I am getting the result

Create Data Script
USE tempdb 

go 

IF Object_id('tempdb..#TestData', 'U') IS NOT NULL 
  BEGIN 
      DROP TABLE #testdata; 
  END; 

go 

CREATE TABLE #testdata 
  ( 
     productname NVARCHAR(100) NULL 
  ) 

go 

INSERT INTO #testdata 
SELECT N'Dell 27" Monitor' 

go 

SELECT * 
FROM   #testdata 

go

DONT know why you are not getting
could be datatype of prodcutname .. you are using varchar instead of nvarchar

Getting Result

Tyr this

USE tempdb
go

CREATE TABLE #testdata
(
productname NVARCHAR(100) NULL
)

go

INSERT INTO #testdata
SELECT N'Asus 27" Monitor'
SELECT N'Dell 27'' Monitor'
go

SELECT *
FROM #testdata
WHERE productname LIKE N'Dell 27'' Monitor'

go

i am getting result

I have tried but does not work in my DB.
Can you use manually two single quotes on dell and double quotes on asus so make sure sqlteam website is not removing the difference.

this is your issue

you have to insert data like this

1 Like
create table #quotations(quote nvarchar(150))
insert into #quotations
select 'Dell 27" Monitor' union all
select 'Dell 27'' Monitor' 

select * from #quotations where quote like '%27"%'
select * from #quotations where quote like '%27''%'

drop table #quotations

Your solution is working. Many thanks
I tested and it works. Thanks for your help.