List:General Discussion« Previous MessageNext Message »
From:Douglas Brantz Date:September 9 2000 3:30pm
Subject:HELP!! LOAD infile syntax ERROR?
View as plain text  
Help!!

I am getting a syntax error message with my Load infile command?

mysql>You have an error in your SQL syntax near 'FIELDS TERMINATED BY ',' ENCLOSED BY
> '"' at line 1

I have tried this with double quotes; TERMINATED BY "," ENCLOSED BY """
and
 have tried this with escaping the double quotes; TERMINATED BY "," ENCLOSED BY "\""


I end each line of data with /n  and when I add the LINES TERMINATED BY "\n"  it says
command not found?


Load Data LOCAL Infile "data.txt" into table TableName
(firstname,lastname,password,year,rank,street,address,state,zip,phone,email,info_blob)FIELDS
TERMINATED by ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';


Douglas Brantz wrote:

> I am going to experiment with the input file function of Mysql tomorrow
> morning.
>
> I have spent an hour editing a 650 line excel file and saved it as tab
> delimited.txt.
> Then in word I converted the tabs to "," .
>
> In some fields I have commas inside the quotes and I assume that this
> will not mess things up?
> Some fields are empty so I include them with ,"",
> I don't have the \n ,which I will use to terminate the lines, in quotes
> - is that correct?
>
> Here is a sample :
>
> "Douglas”,”Bond”,”password”,”1971”,”Rank”,”Street
> Address”,"City",”NC”,”Zipcode”,”Phone”,"",”Teacher,  NC 28098”\n
> "Tom”,”Knight”,”password”,”1971”,”Rank”,”Street
> Address”,”City”,”NC”,”Zipcode”,"Phone",”",Senior Military Assistant, US
> Army”\n
>
> Here is how I plan to insert this data - please let me know if this is
> incorrect.
>
> Load Data Infile "data.txt" into table TableName
>
> (firstname,lastname,password,year,rank,street,address,state,state,zip,phone,email,info_blob)FIELDS
> TERMINATED by ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
>
> Thanks in advance,
>
> Douglas
>
> Appalachian State University
> Boone, NC 28607
>
> --
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/php/manual.php" before
> posting. To request this thread, e-mail mysql-thread50133@stripped
>
> To unsubscribe, send a message to:
>     <mysql-unsubscribe-brantzdr=appstate.edu@stripped>
>
> If you have a broken mail client that cannot send a message to the above
> address(Microsoft Outlook), you can use http://lists.mysql.com/php/unsubscribe.php

--

Douglas Brantz
Computer Consultant
Fine & Applied Arts
Appalachian State University
Boone, NC 28608

828-262-6312 FAX
828-262-6549 OFFICE
brantzdr@stripped


Thread
infile syntax questionDouglas Brantz9 Sep
  • HELP!! LOAD infile syntax ERROR?Douglas Brantz9 Sep