Subject | Trigger to update a table |
---|---|
Author | Clément Doss |
Post date | 2001-11-29T18:33:56Z |
Hello,
I have a table like
CREATE TABLE "MYTABLE"
(
"CODE" INTEGER,
"UPDATE_DT" DATE
);
I would like to update the field Update_DT when CODE is updated.
I am trying to use the trigger below...
CREATE TRIGGER UpdateDate FOR MYTABLE
#1 BEFORE UPDATE AS
BEGIN
IF (NEW.CODE<>OLD.CODE) then begin
UPDATE MYTABLE
SET Update_DT = 'Today'
#2 Where MyTable.Code = Old.Code;
end
END
I am unable to update the Date.
Any clues?
Cheers,
Clément
I have a table like
CREATE TABLE "MYTABLE"
(
"CODE" INTEGER,
"UPDATE_DT" DATE
);
I would like to update the field Update_DT when CODE is updated.
I am trying to use the trigger below...
CREATE TRIGGER UpdateDate FOR MYTABLE
#1 BEFORE UPDATE AS
BEGIN
IF (NEW.CODE<>OLD.CODE) then begin
UPDATE MYTABLE
SET Update_DT = 'Today'
#2 Where MyTable.Code = Old.Code;
end
END
I am unable to update the Date.
Any clues?
Cheers,
Clément