Yelena Varshal (11/2/2007)
I think that UPDATE() is incorrect answer.
The question was:
"Within a trigger, how can you tell if a value has altered on a specific column? "
The explanations for the UPDATE() in BOL are:
"Returns a Boolean value that indicates whether an INSERT or UPDATE attempt was made on a specified column of a table or view. "
First, as other posters pointed here, the attempt does not mean the update was successful.
That's rather obvious, as you are in the trigger, so the update staement has not yet terminated - if it's an "instead of" trigger it can decide not to do the update, even if it's an "after" trigger it can choose to roll back the transaction, multiple triggers may be firing in sequence and one of those after you in teh sequence can do this. It's completely meaningless to ask, in th etrigger, whether tyhe update was successful.
[quote ]Second: the question is asking about the value being altered, not about the value being inserted.
If you need to know whether the action is an uodate or an insert you will presumably not have the same trigger for both.