Search code examples
mysqlmysql-workbenchtruncatemysql-5.7

MYSQL: 1265 Data truncated for column?


I have the following MYSQL statement:

UPDATE `db`.`appointment` SET `timezone` = 'America/New_York' WHERE (`id` = '114');

When I run it I get:

1 row(s) affected, 1 warning(s): 1265 **Data truncated** for column 'timezone' at row 1 Rows matched: 1  Changed: 1  Warnings: 1    0.110 sec

And instead of the timezone column being America/New_York it is saved as America/Ne.

How can I ensure that the full value is saved and not truncated?


Solution

  • The issue here (pointed out in the comments by @tadman) was that the column length was too small.

    It was VARCHAR(10), when I updated the column to be VARCHAR(256) it has worked as expected.