Re: INSERT Trigger
Posted in 1998
Hi, If I understood the question right ..... You can alter the value of a column in a insert using a trigger. Thats a re-entrant trigger , new in Informix 7.3. TFM shows how to do it. Cheers ========================================= Madan madan@cheerful.com ========================================= On 6 Sep 1998, Pete Bloxam wrote: > Roland, > > I wrote a reply to your newsgroup message and I have a modification. > > I wrote that you can't do it in a trigger, but could use a default column > value by doing the following. > (This assumes the column is of DATE type and is a NOT NULL column, > basically the column gets the new definition as typed in the Alter Table > statement including name, type and null-ability) > > Alter table <tablename> modify ( <date column name> DATE DEFAULT CURRENT > NOT NULL); > > I have a change to this : > > Instead of using the default keyword CURRENT it may have to be TODAY > (CURRENT is right if it's a DATETIME column). > > IMPORTANT: If you use the NOT NULL part then any currently NULL rows for > this column may well get the current day's date in them (the date you run > the statement). If you don't and it's NOT NULL now, you'll be modifying it > to be NOT NULL. > > > To INSERT, by the way, you just don't reference the column in your insert > statement, it'll get it's default. > > > -- > Pete Bloxam