>
> I ran this command:
>
> ALTER TABLE bayes_seen ADD lastupdate timestamp NOT NULL DEFAULT
> CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
>
> It chugged for ~1.5N rows and the result is that all of the lastupdate
> fields
> have a value of 0's.  All new lastupdate columns get set to the current
> time
> but the old ones do not. I am not using InnoDB. I set this up using
> TYPE=MyISAM;
> as specified in the directions.
>
> Is there an incantation to do this in MyISAM or is there something I can
> use
> to set the zero fields after the ALTER TABLE ... ADD completes?

UPDATE table
SET lastupdate = CURRENT_TIMESTAMP
WHERE lastupdate = 0 ;

If that does not work then

UPDATE table
SET lastupdate = CURRENT_TIMESTAMP
WHERE lastupdate = '0000-00-00 00:00:00' ;


Reply via email to