Link to home
Start Free TrialLog in
Avatar of shaileshmark
shaileshmark

asked on

MySQL query to manipulate varchar or text data types with an apostrophe (') in the data

Experts:
I am trying to update data that has an apostrophe character ' in the character string like -- Dreamin' Out Loud , and Eatin' Right And Drinkin' Bad -- these are album titles. but when i use a sql query in MySQL such as the following:

update ppsong
set AlbumID = '17'
where Title = 'Eatin' Right And Drinkin' Bad';
 
I get the following error:

Error Code : 1064
You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'Right And Drinkin' Bad'' at line 3
(0 ms taken)

I get the same error whenever I try to use queries involving data that has an apostrophe in it -- Children's books, Swingin' Blues, etc. Is there any other way i can perform such updates or retrieve such data? Thanks very much.
ASKER CERTIFIED SOLUTION
Avatar of Alf666
Alf666

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of shaileshmark
shaileshmark

ASKER

Thanks very much Alf666