Lazarus

Programming => Databases => Topic started by: DanishMale on February 24, 2021, 05:26:20 pm

Title: [SOLVED] SQL Error: You have an error in your SQL syntax
Post by: DanishMale on February 24, 2021, 05:26:20 pm
Hi guys

I got a question which puzzles me...

I got 2 queries one works the other doesn't..


This one WORKS:
Code: SQL  [Select][+][-]
  1. UPDATE `tablename` SET `tablecolumn` = REPLACE(`tablecolumn`, 'ä', 'ä');

This DOESN'T:
Code: SQL  [Select][+][-]
  1. UPDATE `tablename` SET `tablecolumn` = REPLACE(`tablecolumn`, 'ü','ü');

They are both implemented into the same Zeos Conn and Query in the same order as shown above.

However the latter continously gives this error:

SQL Error: 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 'UPDATE `tablename` SET `tablecolumn` = REPLACE(`tablecolumn`, 'ü', ''

If I test them in phpMyAdmin they work perfectly..... and I am aware of double ' around text items  ;)

Any one with an idea why ?`..... All help appreciated in advance



My solution: Splitted each of these UPDATEs into seperate SQL to be executed and they all worked as expected..... perhaps Zvoni suggestion will work as well... this is NOT tested.....
Title: Re: SQL Error: You have an error in your SQL syntax
Post by: Zvoni on February 25, 2021, 07:53:57 am
By any chance: It isn't the missing BLANK (Space) after the last comma in the paranthesis?
That's the only difference i see.

I remember doing Queries on a DB2, and DB2 seems to be very picky about correct spacing within Functions.
No idea about MySQL.

And maybe phpMyAdmin is preparsing the statement, so that missing BLANKS are "corrected"
Title: Re: SQL Error: You have an error in your SQL syntax
Post by: egsuh on February 26, 2021, 08:01:00 am
Check the code of character ü. In your code it appears, but not in the error message.
TinyPortal © 2005-2018