Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I Select records with Apostrophe in DATA?

Status
Not open for further replies.

bmann

Programmer
Oct 8, 2002
128
US
How do I Select records with Apostrophe in DATA.
Example: O'Neil

Here is my code:

select top 5 * from cal.dbo.name where lastname = 'O'NEIL%'

SQL Analyser does not like this code.

I would appreciate anyone's help.
 
Code:
select top 5 * from cal.dbo.name where lastname = 'Replace(O'NEIL,"'","''")%'

-DNG
 
select top 5 * from cal.dbo.name where lastname = 'O''NEIL%'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top