I have the same application on different hosts bulk inserting into the same table. Each bulk insert fires a trigger. The structure of the table is as follows:
Hostname Quantity
---------------------
BOX_1 10
BOX_1 15
BOX_1 20
BOX_1 11
If I have the following code as part of the trigger:
DECLARE @hostname VARCHAR(20)
SELECT @hostname = Hostname
FROM INSERTED
Each bulk insert contains only one hostname since the application is only capturing data from the box its running on, but if two machines bulk insert simultaneously into the same table, could the INSERTED
table be a combination of bulk inserts from different machines?
Or will the triggers execute sequentially, meaning the INSERTED
table will always contain data from only one application at a time?
I need to know if my code setting the @hostname
variable has any possibility of not being confined to just one choice.