List:General Discussion« Previous MessageNext Message »
From:Lola J. Lee Beno Date:March 25 2006 1:32pm
Subject:Loading Data File into Database Table
View as plain text  
I'm trying to import a set of data into a database (MySQL 5.0.17-max). 
Here's the query that I tried to run:

LOAD DATA INFILE `standardwttype.txt`
INTO TABLE StandardWeightType
FIELDS TERMINATED BY `\t`
LINES TERMINATED BY `\r`
(standard_wt_type_id, standard_wt_desc, standard_wt_lud);

And here's a sample of the data that I'm trying to load:

1	Cobweb	2005-01-13 15:21:50.654149
2	Lace Weight	2005-01-13 15:21:50.654149
3	Sock	2005-01-13 15:21:50.654149
4	Fingering	2005-01-13 15:21:50.654149
5	Baby	2005-01-13 15:21:50.654149


There is a tab between each field, and each line terminates with \r, I 
believe (I use OSX).

I keep getting an error message:

ERROR 1064 (42000): 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 'standardwttype.txt`


I've tried running just the first two line of the query and gotten an 
error message.  I checked the online manual to make sure my syntax is 
correct, and checked "The Definitive Guide to MySQL 5".

How do I make this work?


-- 
Lola - mailto:lola@stripped
http://www.lolajl.net | Blog at http://www.lolajl.net/blog/
Freedom is not free.
I'm in Bowie, MD, USA, halfway between DC and Annapolis.
Thread
Loading Data File into Database TableLola J. Lee Beno25 Mar
  • Re: Loading Data File into Database TablePeter Brawley25 Mar
    • Re: Loading Data File into Database TableLola J. Lee Beno25 Mar
      • Re: Loading Data File into Database TableLola J. Lee Beno25 Mar
      • Re: Loading Data File into Database TablePeter Brawley26 Mar