After changing the data type of a MySql column in order to store Twilio call ids (34 char strings), I try to manually change the data in that column with:
update calls
set incoming_Cid='CA9321a83241035b4c3d3e7a4f7aa6970d'
where id='1';
However I get an error which doesn't make sense seeing as the column's data type was properly modified?
| Level ||| Code | Message
| Warning | 1265 | Data truncated for column 'incoming_Cid' at row 1
By issuing this statement:
... you omitted the length parameter. Your query was therefore equivalent to:
You must specify the field size for sizes larger than 1:
I had the same problem because of an table column which was defined as ENUM('x','y','z') and later on I was trying to save the value 'a' into this column, thus I got the mentioned error.
Solved by altering the table column definition and added value 'a' into the enum set.
You can often get this message when you are doing something like the following:
Resulted in our case in the following error:
The problem turned out to be column misalignment that resulted in a
tinyint
trying to be stored in adatetime
field or vice versa.Your problem is that at the moment your
incoming_Cid
column defined asCHAR(1)
when it should beCHAR(34)
.To fix this just issue this command to change your columns' length from 1 to 34
Here is SQLFiddle demo