0

Hi all,

I need to import a database (currently in excel) to Mysql. I searched a little and found out that CSV files can be imported. However, there is a problem that I am facing. The delimiter for fields in a CSV is a ',' obviously. But many of the fields in my excel database are longtext which have commas.

I'd really appreciate if somebody could tell me how I can resolve this problem and import the data seamlessly without having to enter a 14 Mb file manually.

Thanks

mOrph

2
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by dickersonka
0

on the longtext fields use quotes

1, 7, "allow commas, sample"

thanx mate

0

on the longtext fields use quotes

1, 7, "allow commas, sample"

I tried using quotes the way you gave an example but the following problem occurs:

If i use the same database without the quotes, I am able to all the data although the delimiting of the fields is incorrect as previously mentioned.

But if I try to put the longtext field in quotes, the query does not run. I get an error saying that the first field is not an appropriate data type. which is weird coz the first field is just a int code

Is there any other way you can help me in please

Thanks mate

0

did you try to add these switches?

--fields-optionally-enclosed-by=""" --fields-terminated-by=, --lines-terminated-by="\r\n"

you might only need the first, just depends on what os you are on

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.