Hugo Kornelis (3/15/2016)
This appears to be the same code you also asked help for in this topic: http://www.sqlservercentral.com/Forums/Topic1767785-3411-1.aspx.In the future, please keep questions on the same issue in the same topic, and only start a new topic if you have a new problem, or if the focus of the issue has changed so much that it can be considered a new problem.
@jack-2: You added a comment in the trigger code (which was originally suggested by me in that other topic) that the test on EXISTS in inserted is redundant. That is not the case. When a MERGE statement executes, you can have a trigger fire with @@ROWCOUNT > 0 but inserted empty.
Thanks Hugo, didn't realize that this happened with MERGE.