Hello,
I've written a trigger that should ensure that two fields will always contain the same value. I've written this:
CREATE TRIGGER TAUITEMM3 FOR ITEMM
ACTIVE AFTER UPDATE POSITION 4
AS
BEGIN
IF ((OLD.H <> NEW.H) or (old.h_group <> new.h_group))
then
begin
if ((old.h_group <> new.h_group) and (old.h = new.h))
then
begin
NEW.h = NEW.h_group;
end
else
begin
NEW.h_group = NEW.h;
end
end
IF ((OLD.g <> NEW.g) or (OLD.g_group <> NEW.g_group))
then
begin
if ((old.g_group <> new.g_group) and (old.g = new.g))
then
begin
new.g = new.g_group;
end
else
begin
new.g_group = new.g;
end
end
END
I don't know why, but it's not always working I can't figure out why???
Any help is welcome, thanks in advance,
Charl
I've written a trigger that should ensure that two fields will always contain the same value. I've written this:
CREATE TRIGGER TAUITEMM3 FOR ITEMM
ACTIVE AFTER UPDATE POSITION 4
AS
BEGIN
IF ((OLD.H <> NEW.H) or (old.h_group <> new.h_group))
then
begin
if ((old.h_group <> new.h_group) and (old.h = new.h))
then
begin
NEW.h = NEW.h_group;
end
else
begin
NEW.h_group = NEW.h;
end
end
IF ((OLD.g <> NEW.g) or (OLD.g_group <> NEW.g_group))
then
begin
if ((old.g_group <> new.g_group) and (old.g = new.g))
then
begin
new.g = new.g_group;
end
else
begin
new.g_group = new.g;
end
end
END
I don't know why, but it's not always working I can't figure out why???
Any help is welcome, thanks in advance,
Charl