2 (of many) solutions here: Create the column as a datetime instead and set it with NOW() when you first insert the data.
In your update query, set the hr_con column to the current value. (If you set the value explicitly it will not be updated with the automatic timestamp value.) read this for a proper description: http://www.mysql.com/doc/en/DATETIME.html Mike On Wednesday 07 January 2004 14.12, Leandro Saggin wrote: > Hello, > > I am having problems with columns timestamp, what it happens is the > following: > > I created the following table using timestamp and inserted data in this > table: > > create table con(cod integer not null primary key auto_increment, > cod_access integer, hr_con timestamp(14), hr_descon timestamp(14), status > char); insert into con > values(null,1,'20040107120000','20040107120030','D'); > > when executing select in the table, the data are correct > > select * from con; > +------------------------+-----------------------+------------------------- >+--------------------------+----------+ > > | cod | cod_access | hr_con | > | hr_descon | status | > > +-------------------------+----------------------+------------------------- >+--------------------------+----------+ > > | 1 | 1 | 20040107120000 | > | 20040107120030 | D | > > +-------------------------+----------------------+------------------------- >-+--------------------------+---------+ 1 row in set (0.01 sec) > > then I make one update in the column hr_descon > > update con set hr_descon='20040107120100'; > > there it is the problem, when bringing up to date the column hr_descon for > the value informed in update, the column hr_con is brought up to date > automatically for current date/time > > select * from con; > select * from con; > +------------------------+-----------------------+------------------------- >+--------------------------+----------+ > > | cod | cod_access | hr_con | > | hr_descon | status | > > +-------------------------+----------------------+------------------------- >+--------------------------+----------+ > > | 1 | 1 | 20040107101056 | > | 20040107120100 | D | > > +-------------------------+----------------------+------------------------- >-+--------------------------+---------+ 1 row in set (0.01 sec) > > I am using Operational System Solaris 9 on Sparc Platform and I tested in > versions 3.23.47, 3.23.58 and 4.0.14 of mysql. If somebody to know what > happens please helps I. > > Thanks!!! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]