I am trying to load a csv file into mySQL. I want to ignore 3 columns so I am using the '@' character to achieve that. It seems that everything is being uploaded apart from the data after the first column I ignore (named : 'ignore1').
Is this a bug of mySQL software?
LOAD DATA LOCAL INFILE 'Z:/test.csv'
INTO TABLE IN_Apolo
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS
(name, @date, @ignore1, @ignore2, @ignore3, column3, column4)
set date = str_to_date(@date,'%Y-%m-%d')
;
column3 and column4 appear to be NULL
UPD:
I tried using this code and it works:
LOAD DATA LOCAL INFILE 'Z:/test.csv'
INTO TABLE IN_Apolo
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS
(@name, @date, @column3, @column4)
set name=@name, date = str_to_date(@date,'%Y-%m-%d'), column3=@column3, column4=@column4 ;
but it should work with the first version too.
LOAD DATA LOCAL INFILE 'Z:/test.csv'
INTO TABLE IN_Apolo
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
(@name, @date,@column3, @column4)
set name=@name,date=str_to_date(@date,'%Y-%m-%d'),column3=@column3,column4=@column4;
Try using this...