I’m getting a data too long error when trying to import a CSV file into my MySQL database through Workbench. The problem happens with a BIT column that should store boolean values.
My table structure:
CREATE TABLE PRODUCTS (
PRODUCT_ID INT UNSIGNED AUTO_INCREMENT NOT NULL,
PRODUCT_NAME VARCHAR(255) NOT NULL,
IS_ACTIVE BIT(1) NOT NULL,
PRIMARY KEY (PRODUCT_ID)
) ENGINE = InnoDB;
Sample CSV data:
PRODUCT_ID;PRODUCT_NAME;IS_ACTIVE
156;Sample Product;b'1'
I’ve tried different formats for the boolean field like ‘true’, ‘1’, 1, and b’1’ but none work. I also switched off STRICT mode but still get error 1406. I’m using the table import wizard in Workbench (right click table > import records from external file). What format should I use for BIT columns in CSV imports?