From: sagar bs Date: November 14 2012 12:57pm Subject: Re: Issue regarding the import of the date from csv file to the table in the database in mysql List-Archive: http://lists.mysql.com/mysql/228620 Message-Id: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b15b17d30a9e404ce741551 --047d7b15b17d30a9e404ce741551 Content-Type: text/plain; charset=ISO-8859-1 Hi, There are four columns in my table named like account_name, c1, c2 and c3. Account name is the primary key and c1, c2 contain two different dates and in the column c2 there are few fields showing 0000/00/00, now i need to get the date different(in days) between the dates present in the c1 and c2. That days should be shown in the c3. please help me out. On Wed, Nov 14, 2012 at 3:46 PM, wrote: > >>>> 2012/11/14 10:26 +0530, sagar bs >>>> > As i have the data with some 25 variables in csv file and i need to import > to mysql. > The issue is that the date format in csv file is dd/mm/yyyy and mysql takes > the date format like yyyy/mm/dd. > The number of variables in the csv file are same in the table in database > of mysql. > Please help me out. > <<<<<<<< > Use LOAD DATA s feature of in the same SQL statement importing into a user > variable and using it with SET, using the function STR_TO_DATE: > > load data ... > (..., @dait, ...) ... > SET Sins = STR_TO_DATE(@dait, '%d/%m/%Y') > > . It is not important how many decimal digits match each pattern, but it > cannot match variation in the separators. > > It is required that NULLs in the file take the form '\N' or 'NULL', > depending on escape-option. > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql > > -- Regards SAGAR B S --047d7b15b17d30a9e404ce741551--