Re: a how can I do this in Informix question
Posted in 2005
Hi "feathered snake", :)
I think you want to look into "Triggers"
(see "Guide to SQL: Tutorial") and in the
trigger you probably want to make use of
function "CURRENT" which gives you the
current date (and time). You then can
combine this with functions "YEAR",
"MONTH" and "DAY" to somehow produce
your desired integer and in the trigger update
the column in the just inserted row.
I'm not so much an expert in SQL statements,
so you've to find out the details yourself (or
from someone more SQL literate than me).
[ Quetzalcoatl was worshipped by the Aztecs.
It is derived from Quetzal (hummingbird) and
Coatl (snake) of Nahuatl (ancient Indian language
in the region of Central America). E.g. see
http://home.arcor.de/mfu1/quetzalcoatl.jpg
]
Regards,
Martin
--
Martin Fuerderer
IBM Informix Development Munich, Germany
Information Management
owner-informix-list@iiug.org wrote on 27.10.2005 20:35:58:
> Hello,
>
> I have a problem in Informix that I need to solve.
>
> I have table
>
> Table ABC
> {
> Field1 integer,
> Field2 char(5),
> Insdate integer
> }
>
> What I want now is when an insert occurs on this table on the fields
> (Field1 and Field2) that afterwards the fields Insdate is filled with
> the date of today but stored as a number in the format YYYYMMDD.
>
> Example:
>
> Insert into ABC (Field1, Field2)
> values (1, "Wim");>
> then should the query
>
> Select * from ABC;>
> return:
>
> Field1 Field2 Insdate
> 1 Wim 20051027
>
> My collegue found how to do it in Oracle and now I want to prove it also
> can be done in Informix. I hope. Else me and my big mouth :-)
>
> So help me please.
>
> Thanks,
>
> Wim
sending to informix-list