> I have a pretty large file with a Date column in the format M/D/YYYY.
> 
> Is there a way to either change the Date data type in the table or a method
> to indicate the date format in the LOAD DATA statement in order to handle
> this?

If you are using MySQL 5.0.3 or greater, you should be able to transform
your existing string date datq as you use LOAD DATA statement...

Read up on the syntax for utilizing column lists, user variables and a SET
clause in conjunction with LOAD DATA ---
http://dev.mysql.com/doc/refman/5.0/en/load-data.html


Then the you can use the SET clause to transform your existing string date
data into MySQL's date type using the STR_TO_DATE(str,format) function ---
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html


Basically what you will need to do is specify the column list in your LOAD
DATA statement but for your string date data you will want to substitute a
user variable, then include that user variable in your SET clause inside the
STR_TO_DATE function with the relevant format.


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

Reply via email to