Recent

Author Topic: [SOLVED] SQL Error: You have an error in your SQL syntax  (Read 2222 times)

DanishMale

  • Jr. Member
  • **
  • Posts: 73
[SOLVED] SQL Error: You have an error in your SQL syntax
« 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.....
« Last Edit: February 26, 2021, 05:42:38 pm by DanishMale »
Lazarus 2.2.4 x64 | Windows 10 x64 | Windows Server 2019 x64 | OpenVix 5.4 (Linux) | MySQL Community Server 8.0 x64 | MariaDB 10.5.8 x64 | SQLite 3.40.0 x64 | PostgresSQL 13.1 x64

Zvoni

  • Hero Member
  • *****
  • Posts: 2315
Re: SQL Error: You have an error in your SQL syntax
« Reply #1 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"
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

egsuh

  • Hero Member
  • *****
  • Posts: 1273
Re: SQL Error: You have an error in your SQL syntax
« Reply #2 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