Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server using LIKE to search column firstname for " " characters

I am trying to query a database table to return all records where the firstname column contains the characters " ".

For example Lars-Erik "Molle".

I tried this:

SELECT * FROM [bgtest].[dbo].[cuscon] WHERE firstname LIKE '%Lars-Erik%' 

and that returned the record this was just me making sure I was doing it right then I replace the Lars-Erik with "" and ofcourse as it will now look like '%""%' it doesn't like it and returns nothing.

Any ideas I've tried CONTAINS and LIKE and can't figure out a way to do it.

Thanks

like image 614
Brad Gough Avatar asked Dec 25 '22 02:12

Brad Gough


1 Answers

It looks like you need query something like:

SELECT * FROM [bgtest].[dbo].[cuscon] WHERE firstname LIKE '%"%"%' 

Because %""% will search for two subsequent " characters only.

like image 74
Andrey Korneyev Avatar answered May 09 '23 15:05

Andrey Korneyev