From: Hank Date: February 28 2005 4:09pm Subject: Re: problem with adding timestamp as a column List-Archive: http://lists.mysql.com/mysql/180666 Message-Id: <1990a96b05022808096b3be55c@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit I'd suggest not using the keyword "timestamp" as a column name. I'd suggest using "ts" or "tstamp" or something like that. To update the records to the current timestamp....: update try set tstamp=null; should do it. I don't know why the default isn't working, though. On Mon, 28 Feb 2005 10:05:32 -0500, Zhe Wang wrote: > Hi, there, > > I have MySQL 4.1.10. I need to add a timestamp column to an existing > table. I am having a problem of setting the newly added column to be the > current time. > > This is what I did: > > CREATE TABLE try (id INTEGER); INSERT INTO try VALUES(1), (2), (3); > > ALTER TABLE try ADD timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP; > > SELECT * FROM try; > > +------+---------------------+ > > | id | timestamp | > > +------+---------------------+ > > | 1 | 0000-00-00 00:00:00 | > > | 2 | 0000-00-00 00:00:00 | > > | 3 | 0000-00-00 00:00:00 | > > +------+---------------------+ > > I've read the on-line manual regarding the change in timestamp, still > couldn't figure out why 0's got inserted instead of a meaningful current > time stamp. I would greatly appreciate if someone can let me know what > the correct way is. Unfortunately I cannot recreate the table. > > Thank you very much! > > Regards, > Zhe > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql?unsub=heskin@stripped > > -- -Hank