Re: LOAD DATA INFILE with space after quote but before comma
2013/12/18 11:07 -0500, Anthony Ball 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? Well, strictly speaking, it is a bug, in your file. If you can keep that from happening that is best, because in a CSV file the quotemark may appear only first, last, or next to a separator, unless it quotes another quote-mark. Otherwise, if it is consistent as in Dhaval Jaiswal s (2), only do as he suggests. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
LOAD DATA INFILE with space after quote but before comma
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 | ++--+
Re: LOAD DATA INFILE with space after quote but before comma
(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 a...@suave.net 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