Hi.

On Wednesday 08 August 2007 18:39, Jason Pruim wrote:
> Did some more testing, made a new table and matched the field names,
> now it will load it without any errors, it's just only importing the
> first row... Not the rest of the 934 records...

You are using ENCLOSED BY '"' in your SQL, which I have had cause hassle 
with excel generated csv files. Basically, excel will only wrap field 
values in double quotes if the value contains the field delimiter. This 
caught me out, although I seem to remember I did get an error. Try 
removing the ENCLOSED BY anyway, it's optional.

Another thing to watch for is column headers in your input file that may be 
triggering column constraints. You can get past this by using the IGNORE n 
LINES syntax in your command.

I usually specify the table column names too - I have happily loaded up csv 
files from excel with something like the following:

LOAD DATA LOCAL 
INFILE 'file.csv' 
INTO TABLE MyTable
FIELDS TERMINATED BY ',' 
LINES TERMINATED BY '\n' 
IGNORE 1 LINES
(column1,column2,column_etc);

Hope this helps.

Mark


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to