Subject | timestamp trigger? |
---|---|
Author | Fernando Salaices |
Post date | 2006-10-12T22:11Z |
Hello everyone.
I need to have a timestamp that is updated every time a record is
inserted or updated. I had asumed that just declaring the field as
Timestamp this wold be acomplished but I was wrong. So a trigger
(before update or insert) would be the next best thing. This is how I
obtain the current date from firebird:
select CURRENT_TIMESTAMP,
from rdb$database;
So I tried:
select CURRENT_TIMESTAMP into NEW.MYTIMESTAMPFIELD,
from rdb$database;
did not work, so I tried:
select CURRENT_TIMESTAMP into :NEW.MYTIMESTAMPFIELD,
from rdb$database;
Did not work either. So, can some one help me please? Is there another
way to obtain an auto timestamp field?
Can a BEFORE UPDATE and a BEFORE UPDATE OR INSERT coexist? Because my
table already has a BEFORE INSERT trigger.
--
Saludos,
Fernando Salaices.
I need to have a timestamp that is updated every time a record is
inserted or updated. I had asumed that just declaring the field as
Timestamp this wold be acomplished but I was wrong. So a trigger
(before update or insert) would be the next best thing. This is how I
obtain the current date from firebird:
select CURRENT_TIMESTAMP,
from rdb$database;
So I tried:
select CURRENT_TIMESTAMP into NEW.MYTIMESTAMPFIELD,
from rdb$database;
did not work, so I tried:
select CURRENT_TIMESTAMP into :NEW.MYTIMESTAMPFIELD,
from rdb$database;
Did not work either. So, can some one help me please? Is there another
way to obtain an auto timestamp field?
Can a BEFORE UPDATE and a BEFORE UPDATE OR INSERT coexist? Because my
table already has a BEFORE INSERT trigger.
--
Saludos,
Fernando Salaices.