• upperbognor (10/14/2008)


    Jeff I have a question about the need to check for existance when nothing is being done on the else statement.

    Does this not create added overhead because if it doesn't exist it's filtered by the where clause of your select statement.

    You are correct that I should have omitted the IF in the example code to provide a better trigger since the Where clause, which was incorrect as well (I used 12 instead of 10), does filter out the unwanted rows. The example was designed to show that the trigger using a variable to handle an IF will not work as anticipated (the prior trigger code) and to show the correct way to handle and IF condition in a trigger. The code within the IF was not the "important" part of the example. Perhaps there were other business rules that would have been enforced in that IF that required the IF. In this case that was not true.

    Thanks for the catch.