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
That error means the data is too large for the data type of the MySQL table column.
Go to your config/database. php change MySQL strict to false. Show us the migration for the table. It looks to me that the value you are trying to insert into priority is longer than the type specified, hence the truncation.
In databases and computer networks, data truncation occurs when data or a data stream (such as a file) is stored in a location that is too short to maintain its full length.
TRUNCATE TABLE empties a table completely. It requires the DROP privilege. Logically, TRUNCATE TABLE is similar to a DELETE statement that deletes all rows, or a sequence of DROP TABLE and CREATE TABLE statements. To achieve high performance, TRUNCATE TABLE bypasses the DML method of deleting data.
Your problem is that at the moment your incoming_Cid
column defined as CHAR(1)
when it should be CHAR(34)
.
To fix this just issue this command to change your columns' length from 1 to 34
ALTER TABLE calls CHANGE incoming_Cid incoming_Cid CHAR(34);
Here is SQLFiddle demo
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With