DBAtlas · Database operations atlas

1292: Incorrect datetime value / truncated incorrect value

MySQL

What does it mean?

A value was invalid or malformed when converted to the target column type (especially date/time or numeric). In strict mode MySQL rejects it as an error.

Why does it happen?

Invalid dates or values such as '0000-00-00'; a wrong date format; non-numeric text in a numeric column; strict SQL mode (STRICT_TRANS_TABLES) being active; conversion problems caused by a different character set/collation.

How to fix it

Bring the value into a valid format for the column type ('YYYY-MM-DD' for dates). Use NULL instead of empty/invalid dates. If needed, give an explicit format with STR_TO_DATE: STR_TO_DATE(str, '%Y-%m-%d'). If temporary tolerance is required, review sql_mode, but preferably fix the data. Narrow down to find the offending row.

Open in DBAtlas →

More from this engine