This is my table:
CREATE TABLE `megssage`(
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(256) DEFAULT NULL,
`time_create` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
I would like to add new column as time_updated
with default value "ON UPDATE CURRENT_TIMESTAMP".
I tried this:
ALTER TABLE `megssage`
CHANGE `time_updated` `time_updated` TIMESTAMP NULL DEFAULT ON UPDATE CURRENT_TIMESTAMP
But I am getting an error. Can someone help me?
Try
ALTER TABLE `megssage`
CHANGE COLUMN `time_updated` `time_updated` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ;
If you want to add a field to the megssage
table:
ALTER TABLE `megssage` ADD time_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With