List:General Discussion« Previous MessageNext Message »
From:Dhaval Jaiswal Date:December 19 2013 4:51am
Subject:Re: LOAD DATA INFILE with space after quote but before comma
View as plain text  
(1)
yes it is an issue even i faced. for the remedy i search the {(" ,)  (",)}
values of " , space between " and , & replaced by ", in .csv itself.

(2)
The other way is, if all the values are like space between " , then you can
use space and , in fields terminated by

 LOAD DATA LOCAL INFILE '/tmp/test.csv' INTO TABLE testa FIELDS TERMINATED
BY ' ,' OPTIONALLY
ENCLOSED BY '"';

(3) convert the .csv in insert statement and you can use mysqlimport.




On Wed, Dec 18, 2013 at 9:37 PM, Anthony Ball <ant@stripped> wrote:

> I ran across a curious issue, I'd call it a bug but I'm sure others would
> call it a feature.
>
> I have a csv file with space between the " and , and it causes MySQL to eat
> that field and the field after it as a single field. Is there a setting I
> can use to remedy this or do I just have to make sure no whitespace
> intrudes?
>
> Here is an example:
>
> "testa" ,"testb"
>
>
>
> create temporary table testa (a char(15), b char(5)); LOAD DATA LOCAL
> INFILE '/tmp/test.csv' INTO TABLE testa FIELDS TERMINATED BY ',' OPTIONALLY
> ENCLOSED BY '"';
>
>
>
> Data in table is
>
> mysql> select * from testa;
> +----------------+------+
> | a              | b    |
> +----------------+------+
> | testa" ,"testb | NULL |
> +----------------+------+
>



-- 

Regards
Dhaval

Thread
LOAD DATA INFILE with space after quote but before commaAnthony Ball18 Dec
  • Re: LOAD DATA INFILE with space after quote but before commaDhaval Jaiswal19 Dec
  • Re: LOAD DATA INFILE with space after quote but before commahsv19 Dec