0

This is an additional question asked here mysql + importing a file with spaces in the column headers + how to handle

and in my case the header contains blank space and in the table column is different so I need to map the column.

In my db table(abc) the column name is xyz and in file the column filed is "Meter Date" which contains blank space, so while using IN FILE LOAD , I need to mention this

LOAD DATA CONCURRENT LOCAL INFILE ? REPLACE INTO TABLE abc FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '' LINES TERMINATED BY '\n' IGNORE ? LINES (@Meter Date )SET xyz = NULLIF(@ Meter Date, '') , here how to do this ?

Community
  • 1
  • 1
PRASANTA
  • 23
  • 1
  • 8
  • This is fixed now , the variable name could be anything without space and here goes the answer LOAD DATA CONCURRENT LOCAL INFILE ? REPLACE INTO TABLE abc FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '' LINES TERMINATED BY '\n' IGNORE ? LINES (@Meter_Date )SET xyz = NULLIF(@Meter_Date, '') it will determine from sequence and not from column name – PRASANTA Sep 21 '16 at 13:42
  • {LOAD DATA CONCURRENT LOCAL INFILE ? REPLACE INTO TABLE abc FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '' LINES TERMINATED BY '\n' IGNORE ? LINES (@Meter Date )SET xyz = NULLIF(@ Meter Date, '') } – PRASANTA Sep 21 '16 at 13:43

0 Answers0