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.
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
- What do you think about this answer? E-mail us at editor@searchDatabase.com with your feedback.
- The Best Microsoft SQL Server Web Links: tips, tutorials, scripts, and more.
- The Best SQL Web Links
- Have a SQL tip to offer your fellow DBA's and developers? The best tips submitted will receive a cool prize--submit your tip today!
- Ask your technical SQL questions--or help out your peers by answering them--in our live discussion forums.
- Ask the Experts yourself: Our SQL guru is waiting to answer your technical questions.