I'm kinda new at database world and got stucked in my work with the every column in the database that supposed to be DATETIME, or TIMESTAMP, or anything related to date is VARCHAR(250) Ex.: 201610251557.
My question is, there is a way, to change the column to date, withou losing the values on it?
I already tried to change the column structure, but it changes every value to 0000-00-00 00-00.
Safest scenario is:
You can have a look at str_to_date; it operates like this:
SELECT STR_TO_DATE('201610251557', '%Y%m%d%H%i');
With that iso formatted output, perhaps you can update your column like this:
update my_table set datecol = STR_TO_DATE(datecol, '%Y%m%d%H%i');
you can create another table with str_to_date() function then delete the previous rename new one to previous or restore it to original