MYSQL Truncado valor DOBLE incorrecto


Cuando se ejecuta la consulta SQL siguiente:

UPDATE shop_category 
SET name = 'Secolul XVI - XVIII' 
    AND name_eng = '16th to 18th centuries' 
WHERE category_id = 4768

Se plantea el siguiente error:

1292 - Truncated incorrect DOUBLE value: 'Secolul XVI - XVIII'

¿Cómo arreglar esto?


shop_category estructura de la tabla:

category_id   mediumint(8)
name        varchar(250)
name_eng      varchar(250)
Author: Nae, 2010-08-11

8 answers

No necesitas la palabra clave AND. Aquí está la sintaxis correcta de la instrucción UPDATE :

UPDATE 
    shop_category 
SET 
    name = 'Secolul XVI - XVIII', 
    name_eng = '16th to 18th centuries' 
WHERE 
    category_id = 4768
 156
Author: Darin Dimitrov,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-08-11 07:40:04

Estaba recibiendo esta excepción no por Y en lugar de coma, de hecho estaba teniendo esta excepción solo porque no estaba usando apóstrofos en la cláusula where.

Como mi consulta fue

update table set coulmn1='something' where column2 in (00012121);

Cuando cambié la cláusula where a where column2 in ('00012121'); entonces la consulta funcionó bien para mí.

 53
Author: Sidra,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-09-28 10:01:58

Intenta reemplazar el AND por ,

UPDATE shop_category 
SET name = 'Secolul XVI - XVIII', name_eng = '16th to 18th centuries' 
WHERE category_id = 4768

La sintaxis de ACTUALIZACIÓN muestra una coma que debe usarse como separador.

 11
Author: codaddict,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-08-11 07:40:30

Principalmente cadenas de consulta inválidas darán esta advertencia.

Incorrecto debido a un sutil error de sintaxis (paréntesis correctos fuera de lugar) al usar la función INSTR:

INSERT INTO users (user_name) SELECT name FROM site_users WHERE
INSTR(status, 'active'>0);

Correcto:

INSERT INTO users (user_name) SELECT name FROM site_users WHERE
INSTR(status, 'active')>0;
 3
Author: Adrian Goia,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-10-25 14:43:27
$up="UPDATE users1 SET user_fname='$fname' and user_lname='$lname' where user_emp_code=$emp";

Después de eliminar y reemplazar el and con , está funcionando bien:

$up="UPDATE users1 SET user_fname='$fname', user_lname='$lname' where user_emp_code=$emp";

 1
Author: user2885382,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-10-16 08:03:10

Acabo de perder mi tiempo en esto y quería añadir un caso adicional donde este error se presenta.

SQL Error (1292): Truncated incorrect DOUBLE value: 'N0003'

Datos de ensayo

CREATE TABLE `table1 ` (
    `value1` VARCHAR(50) NOT NULL 
);
INSERT INTO table1 (value1) VALUES ('N0003');

CREATE TABLE `table2 ` (
    `value2` VARCHAR(50) NOT NULL 
);

INSERT INTO table2 (value2)
SELECT value1
FROM table1
WHERE 1
ORDER BY value1+0

El problema es ORDER BY value1+0 - tipo de fundición.

Sé que no responde a la pregunta, pero este es el primer resultado en Google para este error y debe tener otros ejemplos donde este error se presenta.

 1
Author: hrvoj3e,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-14 14:19:51

Si tienes este problema con una inserción que se parece a la siguiente, el problema puede ser simplemente la falta de un espacio entre -- y el texto del comentario:

insert into myTable (a, b, c)
values (
   123 --something
  ,345 --something else
  ,567 --something something else
);

El problema con esto es que el --something en realidad debería ser -- something con un espacio.

 0
Author: Joe Phillips,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-06-14 20:08:36

Estaba recibiendo el mismo error y que se resolvió después de reemplazar Y con "," entre dos valores de columna.

UPDATE IGNORE TRANSFORMERDATA SET TRANSFORMERNAME='DummyXmer.jar", REMARKS = "DummeyXmer" DONDE GENERATEDRUNID= "DB1-DB2RYTSYFGWTY8966"

 -5
Author: Payal Gupta,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-02-07 11:03:00