-3
WHERE Variable = 'Lowe's';

But string is ending at Lowe because it recognizes the 's as end of String.

How to circumvent this?

John Conde
  • 217,595
  • 99
  • 455
  • 496
ZJAY
  • 2,517
  • 9
  • 32
  • 51

2 Answers2

4

Use two '

WHERE Variable = 'Lowe''s'

SQLFiddle demo

juergen d
  • 201,996
  • 37
  • 293
  • 362
2

Although escaping ' with '' works, in case you are running this command from any application you should take a look at databinding and using SqlParameters - spares you a lot of headache, improves performance and security.

Linky
  • 605
  • 8
  • 24