Reputation: 1681
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?
Upvotes: 1
Views: 7032
Reputation: 77
I was also having this problem when trying to Update a column with a value. Both the Column and value were Decimal.
The reason mine didn't work was because I was formating the value to be updated
E.g.
Update Account Set Balance = Format(NewValue, 2)
To Solve this I just removed the Formating and just set it to NewValue
and as for why I was formatting the value
I was worried about the extra zeros accompanying the data, it was like 100.000000000000
something like this.
Upvotes: 2
Reputation: 1681
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.
Upvotes: 1