为列截断的数据?

2021-11-20 00:00:00 twilio warnings mysql

更改 MySql 列的数据类型以存储 Twilio call ids (34字符字符串),我尝试手动更改该列中的数据:

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?

<代码>|级别 |||代码 |留言<代码>|警告 |第1265章第 1 行incoming_Cid"列的数据被截断

推荐答案

您的问题是目前您的 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

相关文章