Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with trigger

Status
Not open for further replies.

RedLion

Programmer
Sep 13, 2000
342
NL
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top