Comments - How to convert datetime format while importing xml

 
3 years, 4 months ago Ian Gilfillan

You can use SET COLUMN and the STR_TO_DATE function, for example:

LOAD XML INFILE "C:/temp/test.XML" INTO TABLE dmlicensedata.test 
  ROWS IDENTIFIED BY '<item>'
 (column1, @var1, ...)
  SET column2 = STR_TO_DATE(@var1,'%d/%m/%Y %r'), column3=... ;

Note if your original data uses American dates, the day and month will be reversed.

 
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.