Reputation: 465
I need to replace "e;
in a string. I tried to do this:
SET `title` = REPLACE( `title`, '"', '' )
but it gives me a parsing error.
This is the error:
#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 ''")' at line 1
Server version: 5.5.57-cll - MySQL Community Server (GPL)
How do I do this?
Upvotes: 0
Views: 455
Reputation: 11
The semicolon ;
in "
word is the reason. Change your syntax
from
SET `title` = REPLACE( `title`, '"', '' );
to
SET `title` = REPLACE( `title`, '"', '' )#
and before you click Run change separator from ;
to #
Upvotes: 1
Reputation: 364
This is simple approach but it replaces all the " in string.
UPDATE dummy_tab SET metatitle =REPLACE(metatitle,'/"','') WHERE metatitle LIKE '%"'
Upvotes: 0
Reputation: 1203
If I'm to read your error 100% as written... you have the word quote spelled wrong some where.
...for the right syntax to use near ''")'
notice in your error it shows no "e" There for your replace statement would also NOT catch this.
Or more closely looking at the image you posted... you are replacing
"e(semicolon)
with
''
But the error says it is finding the string
"e)
somewhere in your query... Which would seem to be invalid.
Search your code for
")
Upvotes: 0
Reputation: 3090
Your query should work, but it seems like the error is from another query. Anyhow:
Try this:
UPDATE tbl_name
SET
field_name = REPLACE(field_name,
string_to_find,
string_to_replace)
WHERE
conditions;
Example:
UPDATE bbb_sefurls
SET
metatitle = REPLACE(metatitle,
'"e;',
'');
No need for a condition
Upvotes: 0