When a trigger is being run is it possible to have non-zero different count of row in inserted and deleted tables (basically a mix of insert and updates being handled at the same time)?
For example, inserted table could have 2 rows and delete would have 1 row (matching 1 of the rows in inserted) and that would imply the trigger is handling a mix of 1 update (the matching rows in inserted and deleted tables) and 1 insert.
Update
Apparently the use of merge
command might cause 1 trigger to run for all the changes done, see: Merge statement and after triggers on target table Or not, need to test this.
According to https://www.mssqltips.com/sqlservertip/3074/use-caution-with-sql-servers-merge-statement/
the merge
commands caused triggers to be run multiple times, separating updates and inserts.
Solution Update
Assuming this is the entire list of DML actions then there will never be the case when there will be mixed inserts and updates dealt in the same trigger run.