> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-1200-to-1299/e1265.md).

# Error 1265: Data truncated for column

| Error Code | SQLSTATE | Error                 | Description                               |
| ---------- | -------- | --------------------- | ----------------------------------------- |
| 1265       | 01000    | WARN\_DATA\_TRUNCATED | Data truncated for column '%s' at row %ld |

## Possible Causes and Solutions

A value didn't fit the column's type, and the server stored a changed value instead, such as a value that isn't one of an `ENUM`'s members, or a number followed by text. Whether this is a warning or an error depends on the [SQL\_MODE](/docs/server/server-management/variables-and-modes/sql_mode.md):

* With `STRICT_TRANS_TABLES` or `STRICT_ALL_TABLES`, it's an error and the statement fails. `STRICT_TRANS_TABLES` is in the default SQL mode.
* Without them, it's a warning. The statement succeeds, and stores the changed value, for example an empty string for the `ENUM`, or `12` for `'12abc'`.

```
CREATE TABLE tr (e ENUM('a','b'), n INT, s SET('x','y'));

INSERT INTO tr (e) VALUES ('c');
ERROR 1265 (01000): Data truncated for column 'e' at row 1

INSERT INTO tr (n) VALUES ('12abc');
ERROR 1265 (01000): Data truncated for column 'n' at row 1

INSERT INTO tr (s) VALUES ('x,z');
ERROR 1265 (01000): Data truncated for column 's' at row 1
```

`ALTER TABLE` also gives this error when it changes a column so that existing values don't fit, for example when it removes an `ENUM` member that is in use, or makes a `VARCHAR` shorter than the longest value. The row number in the message is the first row that doesn't fit.

Some changes are only a note, even in strict mode, for example when a `DECIMAL` value is rounded to the column's scale, or the time is dropped from a value stored in a `DATE` column. Use [SHOW WARNINGS](/docs/server/reference/sql-statements/administrative-sql-statements/show/show-warnings.md) to see them.

To solve the error:

* Correct the value. Find the row with the row number in the message.
* Change the column so that the value fits, for example add the `ENUM` member or make the column wider.
* For `ALTER TABLE`, first find and fix the values that don't fit, for example with `SELECT … WHERE CHAR_LENGTH(v) > 5`.
* Turn off strict mode only if you want the changed values to be stored. The data is then changed without an error.

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
