Microsoft® SQL Server™ 2008 All-In-One Desk Reference For Dummies®
by Robert D. Schneider, Darril Gibson
IV.3.2. DDL Triggers: Letting Your Server or Your Database Look After Itself
Data Definition Language (DDL) triggers have been in SQL Server since SQL Server 2005. Like Data Manipulation Language (DML) triggers, DDL triggers can't be called directly. Instead, they respond to DDL events. DDL events are created when DDL statements are executed. DDL statements that can fire triggers include
CREATE: The CREATE statement is used to create objects, such as tables, databases, and logins.
ALTER: The ALTER statement is used to make modifications to objects.
DROP: The DROP statement is used to remove objects.
GRANT: The GRANT statement is used to grant permissions.
|
DDL triggers have two possible scopes: database and server. The scope identifies the type of objects that the trigger will monitor.
Database scope: A trigger with a database scope monitors objects within a specific database. These include tables, views, stored procedures, functions, or any other object within a database that can be manipulated.
Server scope: A trigger with a server scope monitors any objects ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
