How to change VARCHAR type to DATETIME using ALTER in MySQL?

aizaz picture aizaz · Mar 11, 2013 · Viewed 41k times · Source

How can I change VARCHAR() type to DATETIME using ALTER in MySQL?

Answer

Meherzad picture Meherzad · Mar 11, 2013
ALTER TABLE <tblName> MODIFY <columnName> dataType constraint;

For your requirement it will be

ALTER TABLE <tblName> MODIFY <columnName> datetime;

Refer http://dev.mysql.com/doc/refman/5.1/en/alter-table.html