4 messages in com.mysql.lists.win32Re: Fields terminated problem
FromSent OnAttachments
Adrian Greeman02 Dec 2005 04:54 
Daniel da Veiga02 Dec 2005 09:14 
SGr...@unimin.com02 Dec 2005 10:45 
Adrian Greeman04 Dec 2005 02:43 
Subject:Re: Fields terminated problem
From:Daniel da Veiga (dani@gmail.com)
Date:12/02/2005 09:14:55 AM
List:com.mysql.lists.win32

OK, I'm not sure and I don't have the time to test it myself (you can do it if you must), but I don't see any reference of fields from the table in the syntax, just the table name.

LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt' [REPLACE | IGNORE] INTO TABLE tbl_name [FIELDS [TERMINATED BY 'string'] [[OPTIONALLY] ENCLOSED BY 'char'] [ESCAPED BY 'char' ] ] [LINES [STARTING BY 'string'] [TERMINATED BY 'string'] ] [IGNORE number LINES] [(col_name_or_user_var,...)] [SET col_name = expr,...)]

(quoted from the MySQL Manual)

I'm not sure if you can load specific fields...

On 12/2/05, Adrian Greeman <adri@constructionplus.net> wrote:

Please excuse me if this is a common problem - there is so much on the list that I have not worked out how to check back

I have Win XP SP2 MySQL5 Apache2 and PHP5 All very recent.

Anyway IO am trying to import some values from a text file

I use :

LOAD DATA INFILE 'C:/xxxx/My Documents/yyy/datafile.TXT' INTO TABLE chng(IssueNo, Head, chrdate, auth_id, PaperName) FIELDS TERMINATED BY ':::';

(I have substituted xxx for the full path which I used)

But it will not run - just gives me --- "You have an error in your SQL syntax.................near fields terminated by at line 3"

I tried it with MySQL Query Browser and phpMyadmin, though in each case writing the SQL so it could have been command line also.

But I cannot find out why this is the wrong syntax - it seems to be what the MySQL cookbook recommends and the manual. I tried also LOAD DATA LOCAL INFILE but same result Can anyone help and is this a common issue?

Regards

AdrianG