SQL Server Database Triggers
1h 39mAdvanced2020-08-25
Authors

Adam Wilbert
Data Visualization Expert
Course details
SQL Server database triggers help database developers automate routine tasks. Triggers wait for an activating event to occur, then immediately respond with preprogrammed operations. This course, from database expert Adam Wilbert, takes a deep dive into leveraging these powerful and flexible components of a SQL Server database. Follow along and learn how to create and deploy different types of triggers, and get hands-on experience using triggers to solve common problems, such as timestamping data changes or collecting information about table events. Adam also helps you manage your database triggers: enabling, disabling, and reordering triggers as necessary. Plus, follow along with a hands-on project in chapter six, which uses triggers to perform tasks automatically in an inventory management system, such as updating inventory when new product is received.
Topics include:
Trigger types
Creating triggers
Firing triggers
Working with modified data
Creating database- and server-level triggers
Enabling and disabling triggers
Reordering trigger execution
Topics include:
Trigger types
Creating triggers
Firing triggers
Working with modified data
Creating database- and server-level triggers
Enabling and disabling triggers
Reordering trigger execution
Skills covered
SQL ServerData Resource ManagementDatabase AdministrationDatabase ManagementMicrosoftDeep Dive (X:Y)
Concepts
0. Introduction
- 01 - Automate SQL Server with triggers
- 02 - What you should know
- 03 - Make the most of the exercise files
1. Trigger Fundamentals
- 04 - What are SQL Server triggers
- 05 - Two triggers types - INSTEAD OF and AFTER
- 06 - Create a trigger to print a message
- 07 - Timestamp a table modification
- 08 - Firing INSTEAD OF triggers
- 09 - Challenge - Create a trigger
- 10 - Solution - Create a trigger
2. Work with Modified Data
- 11 - Read values modified by a trigger
- 12 - Using the inserted logical table
- 13 - Using the deleted logical table
3. Database- and Server-Level Triggers
- 14 - Triggers on CREATE, ALTER, or DROP
- 15 - Rollback database modifications
- 16 - Reading the EVENTDATA() XML
- 17 - Writing data from the EVENTDATA() function
- 18 - Challenge - Create a DDL trigger
- 19 - Solution - Create a DDL trigger
4. Trigger Management
- 20 - View all triggers in a database
- 21 - Enable and disable triggers
- 22 - Disable nested triggers
- 23 - Recursive triggers
- 24 - Reorder trigger execution
5. Project - Managing Inventory
- 25 - Creating triggers to maintain inventory
- 26 - Counting shipments received
- 27 - Subtract items sold
- 28 - Reorder items when low
Conclusion
- 29 - Next steps