Avoid recursion in TSQL using trigger

I have a trigger that calculates couple of fields on update
or insert.But I need to prevent trigger from firing  when it
updats calculated fields.There is local cursor inside the trigger thru which I do an update.
LVL 1
mdannyAsked:
Who is Participating?
 
NaelConnect With a Mentor Commented:
enclose your trigger by the following IF statement:


Create Trigger ....

BEGIN
IF Not (UPDATE(CalculatedField1) Or UPDATE(CalculatedField2))
  BEGIN
  ....
  PLACE YOUR TRIGGER CODE HERE
  ....
  END

END
 
0
All Courses

From novice to tech pro — start learning today.