I have a table named _Test which has the following values stored in it.
Primary Key : Id
I also have designed a trigger on that table
ALTER Trigger [dbo].[_Test_Data_Save] On [dbo].[_Test] For Insert As --Some custom algorithm which takes about 2-3 seconds to complete
Now, 3 records were saved at the same time from 3 different sessions at the same microsecond like in the image below.
Now my question is how will the trigger work for the last 3 records?
Will the last 3 records fire 3 different triggers:-
- one by one (according to the order they are saved in)
- in any random order SQL seems fit
If the trigger is not executed one by one then what can i do so that they execute the trigger for the record of Id=5 first then after completion of that Id=6 and then trigger for Id=7.