> -----Original Message-----
> From: Jason Pruim [mailto:[EMAIL PROTECTED]
> Sent: 09 August 2007 14:16
> To: Gary Josack
> Cc: mysql@lists.mysql.com
> Subject: Re: Import file into MySQL Database..
>
>
>
> On Aug 8, 2007, at 5:19 PM, Gary Josack wrote:
>
> >>
> > Try:
> >
> > |load data local infile '|/volumes/raider/aml.master.8.6.07.|csv'
> > into table test fields terminated by ',' enclosed by '"' lines
> > terminated by '\n' |ignore 1 lines
> > |(First, Last, Add1, Add2, City, State, Zip, XCode, Reason, Date);
> >
> > If that doesn't work could you please provide more output from the
> > csv file in question?
> > |
> >
>
> The current load file command that I've been trying is:
> load data local infile "/volumes/raider/aml.master.dos.csv" into
> table test fields terminated by "," lines terminated by "" (First,
> Last, Add1, Add2, City, State, Zip, XCode, Reason, Date);
>
>
> I tried adding "\r\n" to the file and it didn't work, here is some of
> the lines from my csv file:
>
> First,Last,Add2,Add1,City,State,Zip,Date,Xcode,Reason
> A. DREW,MILES,,1583 Jerome St,Holland,MI,49423-6703,,P,
> Aaron,Davis,,14796 Creek Edge Dr,Holland,MI,49424,05/17/07,S,
> Aaron,Kraai,,3710 88th Ave,Zeeland,MI,49464-9716,05/17/04,S,
> Aaron,Shuck,,288 W 13th St,Holland,MI,49423-3452,04/28/03,,
> Adam,Hecht,,177 Cambridge Ave,Holland,MI,49423,03/22/05,S,
> ADE,VLIENSTRA,,304 W 30th St,Holland,MI,49423-6971,,,
> Adrienne,Smith,,6795 Ransom Rd,Zeeland,MI,49464,03/31/06,A,
> Anthony,Lewis,,10257 Summerwood Dr,Zeeland,MI,49464,07/30/07,S,Typo
> AL,HOLTROP,,4850 Dellview Ct,Hudsonville,MI,49426-1664,,,
> Alan,Russell,,3624 Diamond Dr,Hamilton,MI,49419-9707,,,
>
> If anyone wants to see the result that I get goto: http://raoset.com/
> tests/legion/index.php
>
> Any help is greatly appreciated!
>
> Thanks!
>

First off, to me it looks like your data is in the format

... state,zip,date,xcode,reason

but your field list is

... state,zip,xcode,reason,date


I have a cron job that updates one of my tables with a CSV file. This uses
the following command which always works well:

load data infile "table.csv"
        into table table_name
        fields terminated by ',' enclosed by '"'
        lines terminated by '\r\n' starting by ''
        ignore 1 lines;

The CSV file has Windows line endings and is imported by MySql on Linux. You
wouldn't need the enclosed by bit for your data though.

HTH,
Edward


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

Reply via email to