Search code examples
mysqlbooleanload-data-infile

mysql load data, issue with boolean field


I m loading data in a mysql table with the instruction :

LOAD DATA LOCAL INFILE "/home/user123/Documents/PartageVB/export tables/pays.csv" INTO TABLE T_PAYS FIELDS TERMINATED BY ";" LINES TERMINATED BY "\n"(id, name, cit,actif);

In the file pays.csv, the column cit is boolean, and gets the value 1 or 0.

My problem is that once LOAD DATA is done, cit always gets the value 1 in the mysql table.

Does anyone know where I m wrong?

In the table, cit type is Bit(1).

Thanks


Solution

  • Please use "TINYINT(1)" instead of "Bit(1)".It might work. Refer this link