I created a FOR INSERT trigger that will fire after inserting. Below are the different scenarios for which I would like to know how trigger will fire.
The trigger is on an employee table.
I begin one transaction where I insert 4 rows. My doubt is how trigger will fire.
- Will it fire immediately after inserting each row?
- Will it fire after completion of all the rows in that transaction
We are able to access the inserted & deleted special tables from the trigger.
- How many rows will be present in those tables each time? Only one record? Or multiple records?
Thank you in advance.
The trigger will fire after each
INSERTstatement.If you have 4
INSERTstatements, each of 1 row, the trigger will be fired 4 times with 1 record in theinsertedspecial table after each insert.If you have 1
INSERTstatement of 4 rows, the trigger will be fired just 1 time with 4 records in theinsertedspecial table after the insert.If they are transactional inserts, the actions you perform in the trigger will be transactional too. This is very important if the trigger has an internal transaction.