title: Modify CSV field on import to mysql
body: <p>I'm trying to import a CSV file to a mysql database.</p>
  
  <p>The CSV file contains (amongst other things) dates in the following format:</p>
  
  <pre><code>"2010-04-31 17:43:12"
  </code></pre>
  
  <p>My first approach was to use the following .sql script:</p>
  
  <pre><code>USE test;
  LOAD DATA INFILE '/tmp/test.cvs'
  replace INTO TABLE test_table
  FIELDS TERMINATED BY ','
  LINES TERMINATED BY '\n'
  (...,mydate,...);
  </code></pre>
  
  <p>which doesn't work because the double quotes make the field "2010-04-31 17:43:12" a string.
  So i figured out i can convert it to DATETIME format using </p>
  
  <pre><code>select STR_TO_DATE("2010-04-31 17:43:12",'(%Y-%c-%e %H:%i:%S)') AS NewDateTime
  </code></pre>
  
  <p>That query works fine on it's own but I was wondering if there's a way of converting the string on the fly while importing. Something amongst the following:</p>
  
  <pre><code>...
  LINES TERMINATED BY '\n'
  (...,STR_TO_DATE(mydate,'(%Y-%c-%e %H:%i:%S)') AS NewDateTime,...);
  </code></pre>