MSSQLTips.com - your daily source for SQL Server tips

Google
 
Web mssqltips.com

ESSENTIALS: Home | Tips | Search | Categories | Top 10 | Products | Authors | Blogs | Forums | Webcasts | Advertise | About
How to use single quotes in where cluase -

in Search

How to use single quotes in where cluase

Last post 06-28-2008 7:31 AM by aprato. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-28-2008 5:06 AM

    How to use single quotes in where cluase

    I want to retrieve names having single quotes. To do this i tryed as select * from hospital where name like' " ' " ' and select * from hospital where name like ''' . But I failed with these two ways . Please help me to do this

    Filed under:
  • 06-28-2008 7:31 AM In reply to

    • aprato
    • Top 10 Contributor
    • Joined on 12-01-2007
    • Greater Boston
    • Posts 191

    Re: How to use single quotes in where cluase

     

     Does this do it for you?  You need escape the single quote and add the wildcarding

    select * from hospital where name like '%''%'

Page 1 of 1 (2 items)