2

I need to write a query where I need to find the ' character.

Like Shivam's - I need to find the ' mark.

select * from DTCountries where CountryCode like '%'%'
lkaradashkov
  • 7,871
  • 1
  • 14
  • 12
Shivi
  • 1,067
  • 9
  • 23
  • 41
  • 1
    possible duplicate of [How do I escape a single quote in sqlserver?](http://stackoverflow.com/questions/1586560/how-do-i-escape-a-single-quote-in-sqlserver) – Conrad Frix Jun 13 '12 at 18:29

2 Answers2

11

Just need to escape it.

SELECT * FROM DTCountries WHERE CountryCode LIKE '%''%'
Kevin Fairchild
  • 10,701
  • 6
  • 31
  • 51
  • The other answer was accepted even though mine came in first (beat him by a whole second... lol), but I still appreciate the Upvotes everyone's been giving. And, yes, seems like a dupe question. – Kevin Fairchild Jun 18 '12 at 16:55
7

Double it up

select * from DTCountries where CountryCode like '%''%'
tomfanning
  • 9,442
  • 4
  • 49
  • 77
SQLMenace
  • 128,762
  • 24
  • 200
  • 224