OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: timestamp for update and insert

From: Michael Dykman (mdykmangmail.com)
Date: Tue Sep 04 2007 - 14:15:57 CDT


Triggers are a fine idea, but I would use a trigger for both cases..
no point putting that level of housekeeping on the application when
you can set rules in the database and more or less forget about it.

 - michael

On 9/4/07, Olaf Stein <steinoccri.net> wrote:
> I would use a trigger (at least for the update)....
>
> The first insert should work with now() and you can leave lastupdateted
> empty
>
>
> Olaf
>
>
> On 9/4/07 3:01 PM, "Hiep Nguyen" <hiepee.ucr.edu> wrote:
>
> > Hi list,
> >
> > i tried to create a table with inserted & lastupdated timestamp fields:
> >
> > create table temp (
> > id int not null primary ke auto_increment,
> > data varchar(100),
> > inserted timestamp default now(),
> > lastupdated timestamp(8));
> >
> >
> > how do i get mysql to put in the current timestamp for inserted &
> > lastupdated fields when i insert a record and only lastupdated when i
> > update the record?
> >
> > thanks,
> > T. Hiep
> >
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=mdykmangmail.com
>
>

--
 - michael dykman
 - mdykmangmail.com

 - All models are wrong. Some models are useful.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql