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.
We are able to access the inserted
& deleted
special tables from the trigger.
Thank you in advance.
The trigger will fire after each INSERT
statement.
If you have 4 INSERT
statements, each of 1 row, the trigger will be fired 4 times with 1 record in the inserted
special table after each insert.
If you have 1 INSERT
statement of 4 rows, the trigger will be fired just 1 time with 4 records in the inserted
special 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With