Hi Taurel,

You can use a perl script to do that work for you.A sample is given below

<code>
#!/usr/local/bin/perl
use DBI;

#These are the configuration variables
$host ="host on which mysql is running";
$uname = "database user";
$pword = "user password pass";
$dbase = "database name";

#Connect to the database
$dbh = DBI->connect("DBI:mysql:database=$dbase;host=$host","$uname","$pword");

#Open the file that has the data and loop thru the file getting the data
open (FILE,'/path/to/tab delimited/textfile');
while (<FILE>) {
        ($field1,$field2)=split (/\t/,$line);
        $sql = "INSERT into tbl_name ........"
        $result=$dbh->prepare($sql);
$result->execute();
}

</code>

The same piece of code should work with an excel file.
the variables $field1 and $field2 can be increased in number according to
the number of fields in your text file.
This is the simplest way that I can think of though there might be another
method.

Regards,
Eric
===============================
Kamara Eric Rukidi Mpuuga
Computer Frontiers International
Plot 32 Lumumba Avenue
P.O Box 12510,Kampala
Tel  :256-41-340417/71
Email:[EMAIL PROTECTED]
Web  :http://www.cfi.co.ug

On Thu, 20 Feb 2003, Inandjo Taurel wrote:

> hi,
> i'd like to have the syntax to import in a mysql table from a tab delimited
> text file, and also the same thing from an excel file.
> Thanx
>
>
>
>
>
> _________________________________________________________________
> STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to