Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysqlimport importing every other record

Status
Not open for further replies.

PulsaMatt

IS-IT--Management
Apr 25, 2002
151
US
I am having an issue where the mysqlimport command is only reading in every other records of my CSV file ... I know what the real problem is but I cant figure out how to solve it.

mysqlimport is reading past the end of the line for each record and reading into the next line ... it then throws a warning because it exceeded the field length for the last field on the previous line. So the last field is getting what it should be, as well as the first few fields of the next record ... once its field mySQL throws a warning and then moves on to the next line.

the command line that I Am using is:

mysqlimport -u foobar database "g:/path/path/filename" --fields-terminated-by="," --fields-optionally-enclosed-by=""" --lines-terminated-by="\n" --local --verbose --replace

This used to work but I added some fields to the data and it has since stopped working properly ... the mysql table matches the fields in the CSV.

Any ideas on how to fix this? Its coming from a CSV that is pulled out of JDEdwards and placed on my file server every night from the AS400 here so it can be used in a web database (ODBC to the 400 is painfully slow).

Thanks in advance,


Matt Laski
Sysadmin, Pulsafeeder Inc.
 
I Am guessing it doesnt but I dont know what else to put there to be honest, \n is the only end of line character I was aware of in a csv file.

Matt Laski
Netadmin, Pulsafeeder Inc.
 
The end-of-line character varies by the operating system on which the document was created.

On Unix and Unix-like OSes, "\n" (newline) ends a line.

On a Win32 box, "\r\n" (carriage-return newline) ends a line.

I believe on some Macintosh OS versions, "\r" was used.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Got it ... its "\r\n"

Matt Laski
Netadmin, Pulsafeeder Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top