MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:R. Hannes Niedner Date:November 9 2002 5:45pm
Subject:Re: MySQL and UPDATE query
View as plain text  
On 11/9/02 3:01 AM, "Bruno Batarelo" <bruno_batarelo@stripped> wrote:
> Greetings
> I have problems executing very simple UPDATE query. I do not know whether it
> is a bug or not, but it works in Access and also works with mySQL, but only
> from access using linked tables.
> Query is as followes:
> UPDATE Table_name SET Field_name = Left(Field_name, 4) & 'a' &
> Right(Field_name, 4);
> This query should change every Field_name's 5'th character to 'a'. One more
> thing - every record in this table has fixed size value so every value is a
> string 10 characters long. When using access database or mysql database over
> access everything goes well, but when using VB and MyODBC or just mysql
> client, every Field_name's value bocomes 0 (zero). What did I do wrong?
> Thank you all
> Bruno Batarelo

Maybe CONCAT() is the answer, haven't tried it though:

UPDATE Table_name SET Field_name = CONCAT(LEFT(Field_name, 4), 'a',
RIGHT(Field_name, 4));



MySQL and UPDATE queryBruno Batarelo9 Nov
  • Re: MySQL and UPDATE queryR. Hannes Niedner9 Nov