Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2010
    Location
    Montreal, CA
    Posts
    32

    Unanswered: Importing .csv into mysql

    I am looking to import a local .csv file into my online mysql database.
    I have already used phpmyadmin to simply "import" /csv files, but I would like a more automated method to do this.

    I thought a .bat file could work, but I am not very familiar with the syntax.

    I am also considering a stored proc. since I am comfortable with SQL, although I am unfamiliar with the syntax to get the .csv file.

    What are your recommendations?

    Ideally, this would eventually become a scheduled job, although it is not the priority for the moment.

    The job will be a recurring event, possibly with different .csv filenames and/or different db table names.

    Thanks.

  2. #2
    Join Date
    May 2010
    Posts
    1
    There are some cool tools like CSV to MySQL that make it easy to import and export CSV files to and from MySQL - but changing the filenames and database tables on an automated job sounds like a tall order. Maybe you need a custom script.

  3. #3
    Join Date
    Feb 2010
    Location
    Montreal, CA
    Posts
    32
    Quote Originally Posted by socaroka View Post
    There are some cool tools like CSV to MySQL
    thanks a lot ill look into this

  4. #4
    Join Date
    Jun 2010
    Posts
    4
    as u want to load a csv file into db.
    --u can use "load data infile my.txt into table table1 fields terminated by ',' "

    --to automate this job for a 'table' with a 'filename' u can write a shell script which calls the above SQL statement which loads the data and run the script through crontab.

    --if ur not using linux shell script follow this procedure in .bat file as i dont know how .bat works or its syntax

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •