列的数据被截断了吗? [英] Data truncated for column?
问题描述
在更改MySql列的数据类型以存储 Twilio调用 ID之后(34 char字符串),我尝试通过以下方式手动更改该列中的数据:
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
推荐答案
您的问题是,当您的incoming_Cid
列定义为CHAR(1)
时,此列应该为CHAR(34)
.
Your problem is that at the moment your incoming_Cid
column defined as CHAR(1)
when it should be CHAR(34)
.
要解决此问题,只需发出以下命令即可将列的长度从1更改为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);
这里是 SQLFiddle 演示
Here is SQLFiddle demo
这篇关于列的数据被截断了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!