Solved

import multiple data files using mysql's LOAD DATA INFILE statement from the command line.

Posted on 2008-10-07
1
2,544 Views
Last Modified: 2012-05-05
I am trying to import not just one but numerous flatfile csv files using LOAD DATA INFILE statement from the mysql command line.  Using the code ive posted below i can insert a single .csv file but I need to be able to insert all .csv files that are in the same directory.  

Ive tried using *, %, and .*\  as wildcard operators but none of them have worked.


mysql --user=username --password=mypassword LOAD DATA LOCAL INFILE 'c:\\\files\\\\\\date20080808.txt.csv' INTO TABLE mytable FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' (field1, field2, field3)

Open in new window

0
Comment
Question by:cebrooks03
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 50

Accepted Solution

by:
Steve Bink earned 500 total points
ID: 22665874
http://dev.mysql.com/doc/refman/5.1/en/load-data.html

The docs do not specifically state it, but I believe it is designed to read a *single* text file.  To import multiple files, you would execute multiple command lines - one for each file.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.

734 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