Issue
When you execute a DDL statement in Data Management (DMS) to make a change, the system prompts the following error.
Data truncated for column
Cause
This problem typically occurs when a field length is updated. In this case, the field length is changed to a smaller value if the updated field length is shorter than the original field length. For example, the original length of a field is 128 bytes. After some data is stored, you want to update the field length to 64 bytes. Because some data in the stored data already exceeds 64 bytes, this error occurs when you update the field length to 64 bytes.
Solutions
Please confirm if you really need to change the length of the field. If necessary, first find the data whose content length exceeds the changed length in the table, and modify the data by updating or deleting to ensure that the content length is smaller than the changed length. Finally, change the length of the Target Field to a smaller value.
note: We recommend that you do not change the field length for data tables that have been put into production. Before you perform this operation, ensure that your data is backed up to avoid data loss or exceptions. You can also back up your database in advance through the Alibaba Cloud DBS. For more information, see what is DBS.
Scope
- Data Management (DMS)