the Reverend
the Reverend

Reputation: 12559

Escape sequence character in sql query parameter in windows azure

When querying a string column, if the search parameter has a " ' " in it, the execution fails due to a syntax error. I tried to use an escape sequence character (if thats how its called), but it still does not work.

SELECT * FROM OpusOne.Accounts WHERE firstName like '%jose\'%'

What would be the correct way to add a quote " ' " to a string parameter ? Thank you

Upvotes: 1

Views: 280

Answers (1)

KrazzyNefarious
KrazzyNefarious

Reputation: 3230

Try this:-

SELECT * FROM OpusOne.Accounts WHERE firstName like '%jose''%'

Escape using another single quote.

Upvotes: 1

Related Questions