×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Problem with trigger

Problem with trigger

Problem with trigger

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close