Solved

How to bulk insert data from cvs file into MySQL database?

Posted on 2007-03-19
3
1,037 Views
Last Modified: 2009-12-16
How to bulk insert data from cvs file into MySQL database?
0
Comment
Question by:ztot
  • 2
3 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18746813
please check out the LOAD DATA INFILE statement from MySQL:
http://dev.mysql.com/doc/refman/5.0/en/load-data.html
0
 

Author Comment

by:ztot
ID: 18746936
Hi thanks for your speedy reply. I have manage to bulk insert the data, however every last field will end with new line (or return carriange).

Example:
Row1.1 Row1.2 Row1.3<new line>
Row2.1 Row2.2 Row2.3<new line>

How to remove the last "new line" command so it will show only Row1.1 Row1.2 Row1.3
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
ID: 18746947
did you specify the following option:
LINES TERMINATED BY '\n'

if yes, does the file eventually have '\r\n' or the like... you will have to specify the exact "line terminator" sequence of the file...
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now