Not here :-( As a seque, Paul's MySQL book has the file and delimiter in double quotes.... ~m
>>> "Martin J. Evans" <[EMAIL PROTECTED]> 11-May-06 10:15:26 AM >>> use DBI; my $dbh = DBI->connect('dbi:mysql:test','xxx','yyy'); $dbh->do(q/load data infile 'data.txt' into table fred fields terminated by '|'/); works for me with mysql client 5.0.15 and dbd::mysql 3.003_1. You do of course need special privileges to use load data. What exactly are you using perl,mysql,dbi-wise, can you paste the exact code you are using and the exact error you are getting. What does a DBI trace of 3 or above output? As others have said, don't put single quotes around your catalog and table or you'll get an error like: DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''fred'' at line 1 at c.pl line 3. You can use ` though but you need use them around the catalog and table separately. Martin -- Martin J. Evans Easysoft Ltd, UK http://www.easysoft.com On 11-May-2006 Mark Galbreath wrote: > Tim, > > I've tried every imaginable option: single quotes, double quotes, escaped > quotes, table name only, no quotes....nothing works. I think there is a bug > in DBD::mysql(3). I have spent hours and hours googling this problem and no > one else has reported it. > > ~mark > >>>> Tim Bunce <[EMAIL PROTECTED]> 11-May-06 08:40:24 AM >>> > > On Wed, May 10, 2006 at 09:26:52AM -0400, Mark Galbreath wrote: >> Of course it's a string. It was a typo. >> >> my $rows = $dbh->do("LOAD DATA INFILE 'data.txt' INTO TABLE 'db.table' >> FIELDS TERMINATED BY '|'"); >> >> 'db.table' == "database_name.table_name" > > Don't put single quotes around the table name. > > db.table > or `db`.`table` > > should work, but 'db.table' won't. > > Tim. > >> >>> Paul DuBois <[EMAIL PROTECTED]> 10-May-06 09:13:47 AM >>> >> >> On 5/10/06 7:58, "Mark Galbreath" <[EMAIL PROTECTED]> wrote: >> >> > Hi guys, >> > >> > The following query works fine from the MySQL client: >> > >> > LOAD DATA INFILE 'data.txt' INTO TABLE 'db.table' FIELDS TERMINATED BY >> > '|' >> > >> > but fails in perl with a malformed SQL syntax error: >> > >> > my $rows = $dbh->do(LOAD DATA INFILE 'data.txt' INTO TABLE 'db.table' >> > FIELDS >> > TERMINATED BY '|'); >> > >> > Anybody have a clue as to why this will not work? >> >> That hasn't the faintest hope of working. You should post the actual code >> that you're using. do() with a non-string argument is surely not your >> actual code. >> >> Also, 'db.table' doesn't look like a valid quoted identifier. >> >> >> >> > >