Posted By

j4kp07 on 12/10/09


Tagged

mysql data import csv infile


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

elfuego1
zingo
virendrakryadav


Date formatting with LOAD DATA INFILE


 / Published in: MySQL
 

URL: http://dev.mysql.com/doc/refman/5.0/en/load-data.html

Came across this nice snippet @ mysql.com

  1. LOAD DATA INFILE '/tmp/foo.dat'
  2. INTO TABLE bar
  3. FIELDS TEMINATED BY '|'
  4. LINE TERMINATED BY '\n'
  5. (col1, col2, @col3, @col4, col5)
  6. SET
  7. col3 = DATE_FORMAT(@col3, '%m/%d/%Y'),
  8. col4 = DATE_FORMAT(@col4, '%Y-%m-%d')

Report this snippet  

You need to login to post a comment.