Triggers

A trigger is a stored procedure that is automatically invoked whenever a specified event (INSERT, UPDATE, or DELETE) modifies a table. A trigger can query other tables and it can include complex Transact-SQL statements.

Triggers are primarily useful for enforcing complex business rules or requirements, such as whether to insert an order based on a customer's current account status.

Triggers are also useful for enforcing referential integrity, preserving the defined relationships between tables when you enter or delete records in those tables. (Note that the best way to enforce referential integrity is to define FOREIGN KEY constraints. For details, see Using Constraints to Enforce Data Integrity.

For details on triggers and stored procedures, see Using Stored Procedures and Triggers.