Posts

Showing posts from January, 2017

MySQL – LOAD DATA INFILE variable data

From [http://www.it-iss.com/mysql/mysql-load-data-infile-variable-data/] MySQL – LOAD DATA INFILE variable data This blog post is to look at MySQL’s capabilities at managing data loads to the database. In particular with a view to performing some processing on the data prior to this being uploaded into the database. This is particularly handy when the format of the data is not consistent, for example different date formats provided. In this paper we will look at two things: Processing different date formats Merging two fields into a single fields stored in the database We have a table “upload” which contains an id, a date field and a varchar field. CREATE TABLE upload ( id INT auto_increment primary key, sdate date, name varchar(100) ); If we had a file containing an id value, an sdate value and a name value this would be very simple: "id","start date","name" 1,"2011-08-21","Tom Thumb" With everything consi