Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data truncated for column 'xxxx' at row 1 [closed]

Tags:

php

mysql

I have just moved a php site to a new server. One of my queries is failing with Data truncated for column 'xxx' ar row 1 message. I checked that this field is float (10,6) type. And the values I provided white updating are not of exactly float(10,6) format and they vary .. like sometimes I put 0 only, or 54.56666 only .. so any idea how do I sort it out??

PS: On the earlier server, everything was working ok. This new server has different (newer) version of mysql. I don't want to make any changes to the mysql config.

like image 352
user187580 Avatar asked Feb 11 '10 10:02

user187580


2 Answers

Also, if you have an enum and you insert a value not present in the enum you can see this error.

like image 134
MeatPopsicle Avatar answered Oct 22 '22 11:10

MeatPopsicle


You tried to put in data that was longer than what your column definitions allow. Please provide the queries you used for us to see. In addition googling the error message yielded:

  • http://forums.mysql.com/read.php?11,132672,132672#msg-132672
  • http://forums.mysql.com/read.php?11,132672,132693#msg-132693
  • http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html

The suggested solution there is to modify the server's "strict mode" setting:

When this manual refers to “strict mode,” it means a mode where at least one of STRICT_TRANS_TABLES or STRICT_ALL_TABLES is enabled.

like image 10
Gordon Avatar answered Oct 22 '22 12:10

Gordon