Dmitrij Holkin
Dmitrij Holkin

Reputation: 2055

SQL Server query syntax with single quote

I have in my database KIA car model like CEE'D.

How to write right syntax to get all car where model = CEE'D

Now I am using semipart of model

SELECT make, model 
FROM Cars 
WHERE model LIKE '%CEE%'

But now I need to get by full model name.

How to write right syntax in this case?

Upvotes: 1

Views: 87

Answers (1)

Mureinik
Mureinik

Reputation: 311053

You can escape a single quote (') with another single quote - two in total (''). Note that this is not the double quote character ("), which is a single character, but two single quote characters (' and then another '):

SELECT make,model FROM Cars WHERE model = 'CEE''D'

Upvotes: 3

Related Questions