I'm updating a table from another table in the same database - what would be the best way to count the updates/inserts?
I can think of a couple of methods:
Join the tables and count (i.e. inner join for update, left join where null for inserts) then perform the update/insert
Use the modification date in the target table (this is maintained correctly) and do a count where the mod date has change, this would have to be done after the update, and before and after the insert... sure you get the idea.
Currently I use method two as I thought it may be faster not having to join the tables, and the modification time stamp data is there anyway.
What are peoples thoughts on this? (I wanted to tag this best-practice, but that tag seems to have disappeared).
EDITED: Sorry, I should have been more specific to the scenario - assume only one concurrent update (this is to update an archive/warehouse overnight) and the provider for SSIS were using won't return the number of rows updated.