>If I can make a suggestion - you might want to considering adding this, in addition to the JOIN between Inserted and Deleted
>
>
>WHERE D.iQty <> i.IQty
>
>
>(and you might even need to account for NULL values as well)
>
>Reason for this - if the trigger fires even though a quantity wasn't changed (i.e. old value and new value are the same), the MERGE doesn't need to occur.
>
>Also -just curious, why use a MERGE when you're only performing an UPDATE?
Thanks for the suggestions.
To be honest, the merge was new to me when I implemented it (and I have not used it since) so I am unsure as to the reason for it being used.
I have similar triggers for insert and delete. (Yikes, looking at it, the Update is done for AFTER INSERT and the Insert is for AFTER INSERT too!)
What would be the better/alternative way to do this?