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
  • 8,609
  • 1
  • 15
  • 12
Shivi
  • 1,075
  • 9
  • 24
  • 42
  • 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,891
  • 6
  • 33
  • 52
  • 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,552
  • 4
  • 50
  • 78
SQLMenace
  • 132,095
  • 25
  • 206
  • 225