DeveloperJr
Programmer
I want to create an INSTAED OF trigger on a table to guarantee that only one contact is primary ‘P’ per CompanyID multiple others can be ‘S’ secondary.
My problem is not how to write the trigger, it is my confusion about a fact that I learned from nice folks here in this forum which is a trigger fires once per update even if we update multiple records. Now how can I handle the multiple update in my trigger code.
Is the code repeats itself for every record in the inserted/deleted virtual tables?
Imagine this scenario, my user try to update 2 records the first will not violate the rules mentioned above but the second will. Will the trigger succeed or fail?
Sorry if this question sound naïve and confusing, we all need to start some where.
My problem is not how to write the trigger, it is my confusion about a fact that I learned from nice folks here in this forum which is a trigger fires once per update even if we update multiple records. Now how can I handle the multiple update in my trigger code.
Is the code repeats itself for every record in the inserted/deleted virtual tables?
Imagine this scenario, my user try to update 2 records the first will not violate the rules mentioned above but the second will. Will the trigger succeed or fail?
Sorry if this question sound naïve and confusing, we all need to start some where.