Re: Reformatting a Column
Hi,
As stated in my last post, this is not recommended due to the loss of data (precision), better to create a view, and over that view do the formatting (steps shown in the previous post).
If you still want change it at table level, then follow these steps:
-- First convert the target column from datetime type to varchar
alter table MyTable change column MyDate MyDate varchar(30)
-- Then apply an update
update MyTable set `MyDate` = date_format( `MyDate`, '%H.%i' );
This will permanently change the column data and get rid of the day/month/year information.
Regards.
*** My opinions do not necessarily reflect the opinions of my employeer ***
Fernando Gonzalez Sanchez
Sr. Software Engineer
MySql Connector/NET Team
Oracle Corporation
Subject
Written By
Posted
Re: Reformatting a Column
March 10, 2014 11:54AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.