clear markdown feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3799284 fiddles created (41684 in the last week).

CREATE TABLE `test` ( `id` mediumint NOT NULL AUTO_INCREMENT, `Date_VARCHAR` varchar(30) DEFAULT NULL, -- `Date_TIMESTAMP` timestamp(6) NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=52383 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
 hidden batch(es)


CREATE TRIGGER tr BEFORE INSERT ON test FOR EACH ROW SET NEW.Date_VARCHAR = STR_TO_DATE(NEW.Date_VARCHAR, '%Y-%m-%dT%h-%i-%s');
 hidden batch(es)


INSERT INTO test (`Date_VARCHAR`) VALUES('2021-05-10T08-45-30'), ('2021-05-10T08-46-30'), ('2021-05-10T08-47-30'), ('2021-05-10T08-48-30'); SELECT * FROM test;
id Date_VARCHAR
52383 2021-05-10 08:45:30
52384 2021-05-10 08:46:30
52385 2021-05-10 08:47:30
52386 2021-05-10 08:48:30
 hidden batch(es)