Chapter 4. Triggers

Itzik Ben-Gan and Dejan Sarka

Triggers are routines that fire automatically as a result of an event in the database server. Microsoft SQL Server supports data-manipulation language (DML), data-definition language (DDL) triggers, and logon triggers, which can be developed either with T-SQL or with .NET code and can fire after or instead of the triggering event. In this chapter I’ll describe in detail the different types of triggers.

Triggers are first and foremost stored procedures in terms of how SQL Server treats them internally. They undergo similar processing phases to stored procedures (parsing, resolution, and optimization). However, triggers do not have an interface (input and output parameters), and you cannot invoke them ...

Get Inside Microsoft® SQL Server® 2008: T-SQL Programming 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.