Skip to content
MySQL

MySQL Error 1366

Incorrect integer, decimal or string value for column

Applies to: MySQL 5.7, 8.0 and 8.4 (an error under strict sql_mode, the default since 5.7; a warning without it)
Last technically reviewed 24 October 2026 on MySQL 8.0.46
The full message
ERROR 1366 (HY000): Incorrect integer value: 'abc' for column 'qty' at row 1
Other forms of this message
A 4-byte character (emoji) in a utf8mb3 column
ERROR 1366 (HY000): Incorrect string value: '\xF0\x9F\x98\x80' for column 'body' at row 1
Characters a latin1 column cannot store (long byte runs end in ...)
ERROR 1366 (HY000): Incorrect string value: '\xC5\xBC\xC3\xB3\xC5\x82...' for column 'body' at row 1
A DECIMAL column
ERROR 1366 (HY000): Incorrect decimal value: '1,234.50' for column 'price' at row 1
PHP PDO
SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'abc' for column 'qty' at row 1
Strict mode off (a warning; 0 is stored instead)
Warning (Code 1366): Incorrect integer value: 'abc' for column 'qty' at row 1
Error number
1366
SQLSTATE
HY000
Symbol
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
Product
MySQL Server
Versions
MySQL 5.7, 8.0 and 8.4 (an error under strict sql_mode, the default since 5.7; a warning without it)
Last reviewed
24 October 2026

What it means

Error 1366 means a value could not be converted to the column's type or character set, such as text in a number column or an emoji in a utf8mb3 column, so strict mode rejected the statement.

MySQL converts every value to the type of the column it is written to. When a string has no usable number in it ('abc', 'n/a', an empty string '', or a formatted amount such as '1,234.50'), or when a string contains characters the column's character set cannot hold, the conversion fails. Under strict sql_mode, which MySQL 8.0 enables by default (STRICT_TRANS_TABLES), the statement is stopped with 1366 and no row is changed. The message names the target type, the rejected value, the column and the row number within the statement.

Incorrect string value is the character set form. The value is shown as bytes, for example '\xF0\x9F\x98\x80', the UTF-8 encoding of an emoji. Characters outside the Basic Multilingual Plane, such as emoji, need four bytes; a column in utf8mb3 (also called utf8) stores at most three bytes per character and a latin1 column holds far fewer characters, so they cannot be stored. The fix is a utf8mb4 column, the MySQL 8.0 default.

Close relatives: a string with a number at the start and junk after it, such as '12abc', raises ERROR 1265 (01000): Data truncated for column instead, and a bad date raises 1292. A number that is too big for the column is 1264, and a string that is too long is 1406.

Common causes

  • A form or API sends text, a placeholder such as 'n/a', or an empty string '' for a number field instead of a number or NULL.
  • Numbers formatted for people, with thousands separators, currency symbols or a decimal comma ('1,234.50', 'GBP 10', '10,5'), are written to INT or DECIMAL columns.
  • An import or INSERT ... SELECT copies a text column from a staging table into a numeric column, and some rows are not numbers.
  • ALTER TABLE changes a VARCHAR column to INT or DECIMAL while some existing rows hold non-numeric text.
  • Emoji or other 4-byte characters are written to a column, table or database created with utf8mb3 (utf8), or text in another script is written to a latin1 column.

Diagnose it

Read-only These statements only read metadata (information_schema, performance_schema and SHOW statements) or your own data. They do not change data, privileges or configuration, so they are safe to run first.

Check the column types and character sets

Use the column name from the message. For Incorrect string value, the character set of that column is what matters, not the table or server default.

SELECT column_name, column_type, character_set_name, collation_name
FROM information_schema.columns
WHERE table_schema = DATABASE()
  AND table_name = 'reviews'
ORDER BY ordinal_position;
What to look for

A utf8mb3 or latin1 character set on the column named in the message explains an emoji or foreign-script failure. A numeric column_type explains an Incorrect integer or decimal value error.

Find the non-numeric values in a staging column

SELECT id, qty_text
FROM staging_items
WHERE qty_text NOT REGEXP '^[[:space:]]*-?[0-9]+[[:space:]]*$'
   OR qty_text IS NULL;
What to look for

Every row whose text is not a whole number (for example n/a, an empty string or 1.5). Those rows would raise 1366 or 1265 when copied into an INT column, or, like 1.5, be rounded. Adjust the pattern for decimals.

Find text with 4-byte characters (emoji) before loading it

Run this on a utf8mb4 source column. The pattern matches any character above U+FFFF, which a utf8mb3 column cannot store.

SELECT id, body
FROM staging_reviews
WHERE body REGEXP '[^\\x{0000}-\\x{FFFF}]';
What to look for

The rows that would fail with Incorrect string value in a utf8mb3 column.

Check the connection character set and sql_mode

If the client connects with a character set that does not match the bytes it sends, text can be misread before it reaches the column. Also confirm whether this session is strict.

SHOW SESSION VARIABLES LIKE 'character_set%';
SELECT @@SESSION.sql_mode;
What to look for

For Unicode text, character_set_client, character_set_connection and character_set_results should be utf8mb4. STRICT_TRANS_TABLES (or STRICT_ALL_TABLES) in sql_mode is why this is an error rather than a warning.

How to fix it

Each fix is labelled with what it changes. Try read-only checks and the least invasive fix first, and test changes outside production.

Send a real number or NULL, not text

Client or network side

Validate and convert input in the application: strip thousands separators and currency symbols, convert a decimal comma to a point, and send NULL (not an empty string) when the field is blank and the column allows NULL. Bind numbers as numbers in prepared statements.

INSERT INTO order_items (id, qty, price) VALUES (1, 3, 1234.50);
INSERT INTO order_items (id, qty, price) VALUES (2, NULL, NULL);  -- unknown, not ''

Clean the values during INSERT ... SELECT

Changes data

When copying from a text staging column, convert blanks to NULL and load only the rows that are numbers. Report the rest back to the data owner rather than guessing a value.

INSERT INTO items (id, qty)
SELECT id, NULLIF(TRIM(qty_text), '')
FROM staging_items
WHERE qty_text REGEXP '^[[:space:]]*-?[0-9]+[[:space:]]*$'
   OR TRIM(qty_text) = '';

Fix the bad rows before changing a column to a number type

Changes data

Find the rows with the read-only query above and correct them (or set them to NULL if that is what the data owner wants). Then run the ALTER TABLE again. Take a backup or copy of the rows first.

Caution: This overwrites values. Agree the rule with the data owner and keep a copy of the affected rows; on a large table, run the ALTER in a maintenance window.

UPDATE products
SET stock = NULL
WHERE stock NOT REGEXP '^[0-9]+$';

ALTER TABLE products MODIFY stock INT;

Convert the column or table to utf8mb4 for emoji and other 4-byte characters

Changes schema

CONVERT TO CHARACTER SET rewrites every text column of the table. utf8mb4 needs up to four bytes per character, so check index length limits on long VARCHAR keys, and make sure the client connects with utf8mb4 too (for example charset=utf8mb4 in a PDO DSN).

Caution: The ALTER copies the table and can take a long time on large tables; run it in a maintenance window and test that indexes, comparisons and sort order still behave as expected with the new collation.

ALTER TABLE reviews
    CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;

Examples

Text in an integer column

CREATE TABLE order_items (
    id  INT PRIMARY KEY,
    qty INT
);

INSERT INTO order_items (id, qty) VALUES (1, 'abc');
Result
ERROR 1366 (HY000): Incorrect integer value: 'abc' for column 'qty' at row 1

Reproduced on MySQL 8.0.46, 24 October 2026.

A formatted amount in a DECIMAL column

CREATE TABLE order_items (
    id    INT PRIMARY KEY,
    price DECIMAL(10,2)
);

INSERT INTO order_items (id, price) VALUES (1, '1,234.50');  -- thousands separator
Result
ERROR 1366 (HY000): Incorrect decimal value: '1,234.50' for column 'price' at row 1

Reproduced on MySQL 8.0.46, 24 October 2026.

An emoji in a utf8mb3 column

CREATE TABLE also returns Warning 1287 that utf8mb3 is deprecated. Typing the emoji itself in the statement gives the same error.

CREATE TABLE reviews (
    id   INT PRIMARY KEY,
    body VARCHAR(200)
) CHARACTER SET utf8mb3;

-- _utf8mb4 X'F09F9880' is the emoji U+1F600, written as bytes so the script stays plain text
INSERT INTO reviews VALUES (1, CONCAT('Great product ', _utf8mb4 X'F09F9880'));
Result
ERROR 1366 (HY000): Incorrect string value: '\xF0\x9F\x98\x80' for column 'body' at row 1

Reproduced on MySQL 8.0.46, 24 October 2026.

Changing a text column to INT when one row is not a number

CREATE TABLE products (
    id    INT PRIMARY KEY,
    stock VARCHAR(20)
);
INSERT INTO products VALUES (1, '12'), (2, '5'), (3, 'unknown');

ALTER TABLE products MODIFY stock INT;
Result
ERROR 1366 (HY000): Incorrect integer value: 'unknown' for column 'stock' at row 3

Reproduced on MySQL 8.0.46, 24 October 2026.

How to prevent it

Validate types at the edge of the application: convert form input to numbers or NULL before it reaches SQL, bind parameters with the right type, and load imports into a text staging table first so you can find the bad rows with a query rather than an error. Create new tables, databases and connections in utf8mb4, and convert old utf8mb3 or latin1 tables before users start sending emoji.

Keep strict mode on. With sql_mode empty, the same INSERT succeeds with a warning and stores 0 for 'abc', and an emoji becomes ?: the data is silently wrong and nobody is told. If you test non-strict behaviour, use SET SESSION sql_mode in a test session only.

Common questions

How do I fix "Incorrect string value: '\xF0\x9F...'" in MySQL?

The column cannot store 4-byte characters such as emoji, usually because it is utf8mb3 (utf8) or latin1. Convert the column or table to utf8mb4 with ALTER TABLE ... CONVERT TO CHARACTER SET utf8mb4, and make sure the client connection also uses utf8mb4.

Why does an empty string give "Incorrect integer value: ''"?

An empty string is not a number, so strict mode rejects it for an INT column. Send NULL for a missing value (if the column allows NULL), or a real default such as 0 if that is what the business rule says.

Should I turn off strict mode to stop error 1366?

No. Without strict mode MySQL stores an adjusted value and only raises a warning: in our test 'abc' was stored as 0 and an emoji as ?. Fix the value or the column instead, and keep STRICT_TRANS_TABLES in sql_mode.

Why do I get 1265 Data truncated instead of 1366?

When the string starts with a number, such as '12abc', MySQL can read part of it and reports that the rest was cut off (1265). When no number can be read at all, such as 'abc', it reports 1366. Both mean the input needs cleaning.

Learn more on CodeWithSQL

Official documentation

Last technically reviewed 24 October 2026; examples and diagnostics run on MySQL 8.0.46. Message templates checked against the server's error catalogue (perror) for that version.

Still stuck on a MySQL error?

Browse the full MySQL error library, or get hands-on help from an experienced SQL professional.