Q
Manage Learn to apply best practices and optimize your operations.

How to return rows that show names with apostrophes

Hi Rudy,
Nice site. Just like to know how I can return rows from my database that show the names in my Name column that have an apostrophe in them,

ie. select *
    from Contacts
    where FamilyName like '%'%'

Obviously this statement is invalid as I don't know how to express the apostophe. Your help would be gratefully appreciated.

Bradley


Hi Bradley

Assuming this is SQL/Server, you can use either single or double quotes to delimit a string, so in this case, use double quotes so that you can have a single quote as part of the string --

select *
  from Contacts
 where FamilyName like "%'%"

For More Information


This was last published in May 2001

Dig Deeper on Oracle and SQL

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close