0
votes

FIELDS TERMINATED BY ',' spliting my csv file single column data into two fields.

Here is my code:

LOAD DATA LOCAL INFILE 'E:/conversion/assets as on 29-10-2015.csv' INTO TABLE tmx_ind_asset_stg_tb FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' IGNORE 1 LINES(id,make,model,desc,sn,customer)

desc column data in csv is : TESTERS, VENTILATOR

but loading data as two fields in database TESTERS in to desc and VENTILATOR in to sn field.

1

1 Answers

0
votes

Encapsulate such fields by a chosen character (" is the most widly used character): "TESTERS, VENTILATOR"

and use

    [[OPTIONALLY] ENCLOSED BY 'char']
    [ESCAPED BY 'char']

parameters of the load data command.