Mysql data length is too long, 1406 - Data too long for column 'express_company' at row 1

Today I encountered a very strange problem with mysql, here is a record to share with you

INSERT INTO HOMS.after_sales_number_fail(deliveryid, tbid, express_number, express_company, failcause, created_time)
VALUES
	('661037', '1519351790999238279', '97612799567071144415560818', 'POSTB', ',请核对单号大小写、单号位数、快递公司名称是否正确,是否存在非法字符等。', '2022-03-19 17:10:11')
> 1406 - Data too long for column 'express_company' at row 1
> 时间: 0.022s

 

The table structure is like this

Replaced a lot of fields and finally located express_company. There is a problem with the length of the field definition.

Replace the length of express_company with 40

The sql statement is executed successfully. After verification, it is found that the data inserted in express_company is the characters POSTB.

 

Why is it okay to specify the length?

This is because the data space given by the data type of the field in your database is too small, so
changing the data type corresponding to the field to a longer length can solve the problem
 

Guess you like

Origin blog.csdn.net/leonnew/article/details/123789064