MySQL 'Truncated incorrect INTEGER value' -
i'm getting odd 'truncated incorrect integer value' error when run following update query:
update tbl set projectnumber = right(comments, 7) createdby = 'me' , length(convert(right(comments, 7), signed integer)) = 7 , convert(right(comments, 7), signed integer) > 0 , convert(right(comments, 7), signed integer) not null , createdon > '2011-01-31 12:00:00' , projectnumber null
projectnumber varchar(10).
when run straight select not error , see results expected. ideas? i'm trying update projectnumber field end of comments in imported notes 7 numeric characters (but projectnumber's not always 7 numeric, why field varchar(10)).
it's not error. it's warning comes convert() when ask convert non-numeric integer;
run these queries in console see:
mysql> select convert(right('1s23d45678', 7), signed integer); +-------------------------------------------------+ | convert(right('1s23d45678', 7), signed integer) | +-------------------------------------------------+ | 3 | +-------------------------------------------------+ 1 row in set, 1 warning (0.00 sec) mysql> show warnings; +---------+------+----------------------------------------------+ | level | code | message | +---------+------+----------------------------------------------+ | warning | 1292 | truncated incorrect integer value: '3d45678' | +---------+------+----------------------------------------------+ 1 row in set (0.00 sec)
as said, it's warning, not error. query should doing update correctly.
Comments
Post a Comment