Re: INSERT Trigger
Posted in 1998
No, default only works on INSERT. It doesn't make any sense to set a default for
update -- the default for an update is to leave the column alone.
June
--
june_t@hotmail.com
Lost in the wilds of Palo Alto, living on Peanut M&M's
Roland Pich'r wrote:
> but I've got another question: is default works only on INSERT (or on UPDATE
> either ??)
>
> Octav Chiriac wrote:
>
> > Roland Pich=F3r wrote:
> > >Hi
> > >
> > >I've got following problem:
> > >
> > >I want to use trigger to set current date in row which I just insert (in
> > >the same table)
> > >
> > >Any ideas how to do this (or just 'no way - it's impossible') ???
> > >
> > >Thanks,
> > >
> > >Roland Pichor
> > >rpichor@ddc.daewoo.com.pl
> > >
> > >
> > I think you could use DEFAULT on the date column. It is more simple.
> >
> > create table tab_name (> > date_column date default today
> > )
> >
> > If you need to insert a timestamp just use DATETIME ... DEFAULT CURRENT ...
> >
> > Hope it helps,
> > Octav
> >
> > --=20
> > Octav Chiriac Phone: (373) 2 21 20 96
> > NetInfo S.R.L. Fax: (373) 2 21 20 96
> > Chisinau (373) 2 24 00 83
> > Moldova, Republic of mailto:com@netinfo.moldova.net