tags:

views:

26

answers:

1

Hello All,

my CSV content looks like this

1234,123;123;123
5675,123;567;234;565

No Space is provided at the end of each row in CSV i.e. 1234,123;123;123(No space here)

Imported this using the following command

mysql> load data local infile 'E:\sample.csv' into table Test.Table1 fields 
terminated by ',' lines terminated by '\n' (Column1,Colunm2);

It gets executed successfully and i can find all the records in the DB. But the second column ends with a pilcrow.

When i try to edit, the value looks like

123;123;123
<extra line here>

If i remove the extra line, the pilcrow disappears.

Type of the column1, column2 is varchar.

Any clues for the issue?

+1  A: 

I believe your problem is because of EOL termination. The file probably is using \r\n instead of only \n, hence the "<extra line here>".

Paulo Santos
I am not sure why there is \r here. Any reasons? I even tried importing the CSV created by exporting the columnvalues from MYSQL. Even that has the same problem. Any insights?
Sri Kumar
This is a conundrum. Because every major OS has it's "right" way, however, today, most people are favoring the CR+LF as EOL. Take a look here http://en.wikipedia.org/wiki/Newline
Paulo Santos
Thanks for the information :)
Sri Kumar