Jeremy, Apart from this perl of wisdom, how about defining two columns: one a 'temporary' text field and the other the 'real date column - as proposed, and importing the date-data into MySQL in the temporary-text field (and leaving the other/real one empty). Then copy the data out of the temporary column, use MySQL's functions to extract and re-concatenate the components into the MySQL sequence, and update the record's real/date column. Once all this is done (and checked - a step which might be harder in the Perl-driven solution) the temporary/construction date-data column can be dropped.
Regards, =dn > > #!/your/path/to/perl > > open(OLD, "yourbigfile.txt"); > open(FIXED, ">newfile"); > while ($line = <OLD>) > { > $line =~ s/(\d{2})-(\d{2})-(\d{4})/$3-$1-$2/g; > print FIXED $line; > } > > Michael > > On Tue, 8 Jan 2002, Jeremy Johnstone wrote: > > > > > I have a flat text file that is about 820mb I need to import into a database > > that has the dates in the format MM-DD-YYYY. MySQL requires dates with the > > year first and when I try importing test chunks of the data all I get is > > zero's in the date field because of the dates being in the wrong format. > > There are about 30 million records so editing the file is not feasible. Will > > someone help me with a solution either with a perl script or some other > > method that you might know of. I am willing to research this further if > > someone will point me in the right direction. > > > > Thank You > > Jeremy Johnstone > > AltDNS.net inc. > > > > *** PLEASE REPLY TO MY EMAIL ADDRESS DIRECTLY *** > > *************** [EMAIL PROTECTED] ************************ > > > > Michael Stassen > University Information Technology Services > Indiana University Bloomington > [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail ><[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php