As we approach the conclusion of this book, we come to an important topic in the specialized stored procedure arena – triggers. Triggers are best used for enforcing business rules as well as performing validation or data modifications, when other methods are not sufficient.
We will see that triggers are mainly used in two areas:
Creating audit records and reflecting changes to crucial business tables
Validating of changes against a set of business rules coded in T-SQL
In this chapter, we will cover:
What a trigger is and why it exists
Performance considerations
How to create a trigger and its different types
Transactions and rollbacks within triggers
Recursive triggers
Good and bad programming practices