Brad Gough Brad Gough - 1 year ago 82
SQL Question

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
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.


Answer Source

It looks like you need query something like:

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

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download