views:

29

answers:

1

I have a mysql table and data entries in it:

CREATE TABLE    `invoices`.`invoices` (
    `InvoiceID` bigint(20) unsigned NOT NULL auto_increment,
    `UserID` int(10) unsigned NOT NULL,
    `Value` decimal(10,3) NOT NULL,
    `Description` varchar(4048) NOT NULL,
    `DateTime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
    PRIMARY KEY    (`InvoiceID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin5;

I want to remove "on update CURRENT_TIMESTAMP" condition. How can I alter this table?

+2  A: 
ALTER TABLE `invoices`.`invoices`
    CHANGE `DateTime` `DateTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
aularon
I only want to remove on update condition. Because I dont want DateTime to be updated on record update.
HasanGursoy
I edited it, now it should default to `CURRENT_TIMESTAMP` on new insertions, but stays as is on update.
aularon