Comments - need to load csv date data along with AM/PM values.

5 years, 11 months ago kranthi kumar

Dear Anel, thanks for Your reply .

27-Dec-2018 03:00:01 AM----> date format in CSV which i m trying to insert

###Query ####

LOAD DATA INFILE '/var/lib/mysql/alepoblr_CDRs_2018_12_25_20_worki.csv' INTO TABLE ROI_RAWCDR_DEC_2018 FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '"' LINES TERMINATED BY '\r\n' (USERNAME,SESSIONID,FRAMEDIPADDRESS,SESSIONAUTHRULE,NASIPADDRESS,REQUESTTYPE,MACADDRESS,NASPORTID,FRAMED_IPV6_ADDRESS,FRAMED_INTERFACE_ID,DELEGATED_IPV6_PREFIX,AGGREGATEKEY,UPLOAD,DOWNLOAD,TOTAL,CDRTIME,@STARTTIME,@ENDTIME) set STARTTIME=str_to_date(@STARTTIME,'%d-%b-%Y %H:%i:%s')

Starttime Column should be inserted AM/PM values but its not allowing AM/PM ....

 
5 years, 11 months ago Anel Husakovic

Hi, did you try to use dateformat ?

 
5 years, 11 months ago kranthi kumar

Yes anel, Used that also but no luck

set STARTTIME=date_format(@STARTTIME,'%d-%b-%y %H:%i:%s'),ENDTIME=date_format(@ENDTIME,'%d-%b-%y %H:%i:%s');

 
5 years, 11 months ago Anel Husakovic

Did you try to use `%p` format ? :)

 
5 years, 11 months ago kranthi kumar

No aneel , where we have to use this

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.