Day 18. Writing and Testing Triggers

Triggers, a feature of most SQL languages, enable you to attach SQL code to an event such as an INSERT request. Triggers enable SQL Server to verify data modifications before they are written and committed to the database. With a trigger, you can check complex data integrity rules, and then perform actions of all kinds on the dependent data. Today, we will cover the following topics:

  • What triggers are

  • How to create triggers

  • How the system executes triggers

In addition to the simple concepts of writing triggers, you will also learn how triggers work. After you have that information, you will learn when triggers are the correct solution to a problem and when they should be avoided.

Get Sams Teach Yourself Transact-SQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.