MySQL Forums
Forum List  »  Other Migration

Running into trouble with Importing CSV containing comma
Posted by: vdfk vdfk
Date: October 26, 2009 07:58AM

I'm a mySQL newbie so please excuse my ignorance and abundance of questions.

I'm having trouble importing a .csv extract into a table via mysqlimport command. Below is the command I use...

mysqlimport --host=localhost --user=root --password=testing1 --fields-terminated-by="," --lines-terminated-by="\r\n" aexworkflow c:\csvimport\aexextractraw.csv

When I run the statement above, i receive the below error...

mysqlimport: Error: 1262, Row 5 was truncated; it contained more data than there
were input columns, when using table: aexextractraw

I know why this error occurs. Its because I have a column in my extract that has a comma inside its content. How can I make mySQL ignore this comma when importing?

One way I can think of avoiding it is to convert the delimiter on the .csv file from "," to "|". However, that will require me to search and replace manually. Is there an automated way of converting .csv files to pipe delimited? Could I possibly schedule this conversion as I plan to automatically download this .csv extract every hour or so?

I've searched the forums and the web for hours but I cannot find a solution to this issue. Any help or guidance is appreciated. Thanks

-vdfk

Options: ReplyQuote


Subject
Views
Written By
Posted
Running into trouble with Importing CSV containing comma
5472
October 26, 2009 07:58AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.