I am trying to import data from csv into MySQL using LOAD DATA LOCAL INFILE. For an integer column called "count" that has all null values I am getting the error 1366 incorrect integer value:
I have tried count = IF(@count='',NULL,@count)
CREATE TABLE MySchema.response:
CREATE TABLE MySchema.response
(
`id` int,
`name` varchar(500),
`count` int,
);
loading data into table:
LOAD DATA LOCAL INFILE 'C:/response.csv'
INTO TABLE MySchema.response
FIELDS TERMINATED BY ',' optionally ENCLOSED by '"'
ignore 1 lines
(id, name, @count)
SET count = IF(@count='',NULL,@count)
sample csv file data
1,abc,
2,xyz,