views:

68

answers:

2

I encountered this error when I attempted to insert something into a MySQL table. What's the possible reason? How to solve this problem?

The raw value of "budget" is 800元, when inserted, it became 800, 元 is missing.

+2  A: 

This would mean that you are trying to insert data that would overflow the allocated storage for that column.

spender
This would happen if you're for example trying to set budget column defined as NUMERIC(5,2) to a value of 123456.78.
Zoran Regvart
A: 

If your SQL Mode is set to strict, any insertion of data that would not fit, will cause an error and the insert will fail, if the mode is non-strict the insert will succeed with truncation giving a warning. But this should not be use as a workaround for this problem. Instead you need to identify the field which is causing this and should update the table to make it wide enough to accommodate the widest data your application might give MySql

codaddict