One of my column data type is varchar (05/03/2016 11:40:00 PM), want to convert the date type 23:40:00 (2016-05-03) The code is as follows, why did not achieve the The table name: cm2016 The original time column name: Date New time column names: daten
BEGIN Declare the done int. Declare cur_test CURSOR for The SELECT STR_TO_DATE ((SELECT Date FROM cm2016 LIMIT 1), '% % % % m/d/Y h: I: % % s % p')
DECLARE the CONTINUE HANDLER FOR the NOT FOUND SET done=1;
The open cur_test;
PosLoop: LOOP
IF done=1 THEN LEAVE posLoop; END the IF; Insert INTO cm2016 (daten) (SELECT STR_TO_DATE ((SELECT Date FROM cm2016), '% % % % m/d/Y h: I: % % s % p')); END LOOP posLoop; The CLOSE cur_test; END