Home Forums SQL Server 2008 SQL Server 2008 - General Why is "instead of delete" trigger not fired by delete inside "after update" trigger RE: Why is "instead of delete" trigger not fired by delete inside "after update" trigger

  • brettstahlman (3/16/2013)


    opc.three (3/16/2013)


    The reason why I disagree is because of the behavior of the after trigger when it is the instead trigger that is fired first. The instead trigger fires the after trigger, but even if the after trigger does something that should fire the original instead trigger on the same table, it does not fire regardless of the values of the nested or recursive settings.

    In your case the after trigger fires first, but similar to the case I just described it will not fire an instead trigger on the same table regardless of the values of the nested or recursive settings.

    Maybe the documentation has a hole in it, it certainly would not be the first time, but the behavior seems to be predictable and consistent. Just my two cents.

    I'm not arguing that it's not predictable and consistent in the instance of SQL Server I'm currently running... But the same could be said of just about any bug in a specific instance of software. My point is that the only sort of predictable behavior we should rely upon as developers is that which can be predicted from the specification, and there is nothing in the spec indicating that the instead of trigger will not be invoked from an after trigger on the same table. Are we in agreement?

    No.

    A good example of changes made by MS that comes to my mind is the WebTasks procedures. Fully documented and useable without special permissions. Then one day MS decides to change that behaviour in a SP and code that worked for many people suddenly broke. IIRC, this change wasn't even communicated prior to it being implemented. What does this have to do with this discussion? Everything.

    This is why you do regression testing when applying CU's, Service Packs, upgrades; to make sure that the behaviour of your code hasn't changed unexpectedly and with possible disastrous effects to your data. From what I have been reading, you are expecting 100% perfection in the MS documentation. Good luck with that.