• Vladan - Friday, August 10, 2018 5:32 AM

    sipas - Friday, August 10, 2018 3:41 AM

    Not sure about this one - I thought that UPDATE() returned TRUE if an attempt was made to update the column, regardless of whether the update was successful. Chose the right answer because it was the only one that had a Boolean value, but is " true for changes or false for no changes" correct?

    Well, I'm not sure about what happens when the update is unsuccessful... I think that if update is unsuccessful, trigger does not fire. But if you update a column with "itself" (not changing the value), UPDATE() returns TRUE. In my opinion, "changes" is generally understood as "there is a difference between 'before' and 'after' ", so the correct answer is rather misleading.
    If you want to fire trigger only when a value changes, it must be done by comparing values in DELETED and INSERTED.

    WOW - First of all - GREAT QOD Question..  Secondly VERY INTERESTING discussion topic posed here.
    While the field value has not changed, it would appear that the record has been altered, as would be indicated by a ModifiedOn DATETIME  field.  
    And when EXACTLY does the update trigger fire ?  Can an update fail before that trigger fires ?
    ---And here is where I would like to leave you with some bit of great wisdom or intelligence, however I lack that ability 🙂