MySQL tool to convert .CSV to SQL statement

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
ljCharlie
Forum Contributor
Posts: 289
Joined: Wed May 19, 2004 8:23 am

MySQL tool to convert .CSV to SQL statement

Post by ljCharlie »

Anyone know a tool that will convert a .csv file or an Excel data into a SQL statement file? I found a tool that will convert a .mdb but I want to convert an Excel document or .csv file format.

Any help is grateful!

ljCharlie
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

mysqlimport: http://dev.mysql.com/doc/mysql/en/mysqlimport.html
LOAD DATA INFILE sql statement: http://dev.mysql.com/doc/mysql/en/LOAD_DATA.html

then you can mysqldump (http://dev.mysql.com/doc/mysql/en/mysqldump.html) it ;) Why would you need to convert csv to sql statements? What the point of such a conversion if you can directly import csv into your database (I'm pretty sure there are tools for other dbs like mysqlimport for MySQL).
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Also, phpMyadmin (sorry no bookmarks right now - google it down) makes it very easy to import csv to mysql.
ljCharlie
Forum Contributor
Posts: 289
Joined: Wed May 19, 2004 8:23 am

Post by ljCharlie »

Many thanks for your response. The reason I need that conversion utility is that the web host I'm working with don't allow load .csv file directly into their MySQL database. They only allow SQL file.

Anyway, I'll your links some clicking and reading.

ljCharlie
Post Reply