CHAPTER 8

image

Triggers

Triggers define the code that runs in response to specific events. There are three types of triggers available in SQL Server:

  1. DML triggers fire when data modification occurs. You can use DML triggers in cases when you need to enforce specific business rules during data modifications, and the system does not have a dedicated data-access tier implemented. You can think about audit-trail functional, which captures who changed the data in the table as an example. When a system has multiple applications working with the database directly, audit-trail implementation based on triggers is the simplest one.
  2. DDL triggers fire in response ...

Get Pro SQL Server Internals 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.