I have a trigger that fires for inserts and updates, the actual text of which may be immaterial as I am first seeking a conceptual understanding.
We are currently using SQLServer2K.
This trigger has worked for prior versions (still backended with SQLServer2K) of our data collection system, but we recently updated this system and now I'm experiencing what I perceive to be a trigger issue.
It uses the inserted table to get data for the inserted/updated entry. It is coded currently using the concept of
set @varname = (select top 1 ... from inserted)
It then goes on and does [possibly] an insert into another table if the updated entry meets certain criteria. The second table has no trigger and I do not update the subject table of the original trigger.
My problem is that our new App release appears to be using more backended logic via mass updates/inserts to the subject table whereas in the past these were (apparently) individual updates/inserts from the client.
Now my observations show that only 1 row gets the benefit of the trigger even when 20 rows were updated or inserted concurrently (based on looking at the 'inserted' or 'updated' timestamp which is exactly the same) for a batch of updates.
Is the inserted (and/or deleted for that matter) table truly populated with data for ALL of the rows impacted by a mass insert/update? Do I need to change this code out to either an SP or to a method that cycles thru all rows in the inserted table? (unfortunately the design of the app db does not use GUIDs or other convenient PK methods)
We are currently using SQLServer2K.
This trigger has worked for prior versions (still backended with SQLServer2K) of our data collection system, but we recently updated this system and now I'm experiencing what I perceive to be a trigger issue.
It uses the inserted table to get data for the inserted/updated entry. It is coded currently using the concept of
set @varname = (select top 1 ... from inserted)
It then goes on and does [possibly] an insert into another table if the updated entry meets certain criteria. The second table has no trigger and I do not update the subject table of the original trigger.
My problem is that our new App release appears to be using more backended logic via mass updates/inserts to the subject table whereas in the past these were (apparently) individual updates/inserts from the client.
Now my observations show that only 1 row gets the benefit of the trigger even when 20 rows were updated or inserted concurrently (based on looking at the 'inserted' or 'updated' timestamp which is exactly the same) for a batch of updates.
Is the inserted (and/or deleted for that matter) table truly populated with data for ALL of the rows impacted by a mass insert/update? Do I need to change this code out to either an SP or to a method that cycles thru all rows in the inserted table? (unfortunately the design of the app db does not use GUIDs or other convenient PK methods)