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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Queriying a field with an apostrophe

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a field, playmates_last_name.
One of the records has a name "O'NEAL".
How can I write a sql statement to get the record with "O'NEAL" as a last name? [sig][/sig]
 
The following will help, but I know there has to be a better way...
Code:
SELECT * 
FROM your_table_name_here
WHERE playmates_last_name like '%NEAL'
Hope that helps until someone wiser than me comes along...
[sig]<p>Terry M. Hoey<br><a href=mailto:th3856@txmail.sbc.com>th3856@txmail.sbc.com</a><br><a href= > </a><br>Ever notice that by the time that you realize that you ran a truncate script on the wrong instance, it is too late to stop it?[/sig]
 
Try this ... select playmates_last_name from table where playmates_last_name like 'O''NEAL'
[sig]<p>Best of Irish Luck, David.<br><a href=mailto:djwilkes@hotmail.com>djwilkes@hotmail.com</a><br>[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top