Building and Optimizing Triggers in SQL Server
Build SQL Server triggers in T-SQL to audit data changes and block unwanted edits, then manage and troubleshoot them, with interactive exercises.
SQL Server triggers are a kind of stored procedure that runs automatically when rows change, tables are altered or users log on. That gives database teams a way to audit activity and hold data to consistent rules. Working in T-SQL, you write triggers that record changes, refuse unwanted updates and deletions, and check stock before an order goes through. You then weigh their known limitations against other options and keep existing triggers under control.
What You Will Achieve
- Build a trigger that keeps a history of row changes for auditing
- Use INSTEAD OF triggers to block unwanted edits or check stock before an order is placed
- Weigh a trigger against a stored procedure or a computed column before choosing one
- Spot a trigger that is causing trouble, then switch it off, change it or drop it
Program Overview
Trigger Basics and Alternatives
Introduces what a trigger is, walks through writing one in T-SQL and compares triggers with other database objects.
- Types of trigger and a first trigger
- How DML triggers track data changes
- Triggers vs. stored procedures and computed columns
Trigger Types, Limitations and Use Cases
Works through each kind of trigger SQL Server offers, then sets their known limitations beside common auditing and prevention uses.
- AFTER and INSTEAD OF triggers (DML)
- DDL triggers and logon triggers
- Known limitations and a report on existing triggers
- Table auditing, database auditing and preventing server changes
Trigger Optimization and Management
Handles the upkeep of triggers already in place and the investigation of ones that misbehave.
- Deleting, altering, disabling and re-enabling triggers
- Managing and counting existing triggers
- Tracking trigger executions and identifying problematic triggers
Certificate Awarded (Paid)
Job Outlook
Trigger skills apply in database development and administration on SQL Server, where teams audit changes to tables, protect data from unwanted edits or deletions, and secure logins.
Good for: Database developers and DBAs on SQL Server who need to audit data changes or guard tables and servers against unwanted edits.
Keep in mind: All examples use T-SQL on SQL Server. Despite the intermediate label, the first chapter starts with what a trigger is and how to create one.
Bottom line: A focused course that pairs each SQL Server trigger type with auditing and prevention exercises, then shows how to manage and troubleshoot triggers already running.
Frequently Asked Questions
Which kinds of SQL Server triggers does it teach?
It teaches AFTER and INSTEAD OF triggers for data changes, DDL triggers for changes to tables and the server, and logon triggers. Examples include tracking retired products, preventing updates to orders, stopping table deletion and tightening database security at login.
What alternatives to triggers does the course compare?
The opening chapter looks at trigger alternatives, comparing triggers with stored procedures and with computed columns. A later chapter sets out the known limitations of triggers and has you build a report on the triggers that already exist in a database.
How do you track down a trigger that causes problems?
The final chapter covers troubleshooting: keeping a record of when triggers execute, identifying problematic ones, and counting the AFTER triggers in place. You also practice disabling a trigger, re-enabling it, altering its definition and removing it.


There are no reviews yet.