Triggers and Event Notification Transact-SQL Enhancements
Microsoft SQL Server 2005 introduces DDL triggers and event notifications.
DDL triggers, like their standard counterparts, execute stored procedures in response to an event. But unlike standard triggers, DDL triggers execute in response to DDL statements. DDL statements are primarily statements that start with CREATE, ALTER, and DROP. DDL triggers are used for administrative tasks, such as auditing and regulating database operations.
Event notifications execute in response to DDL and data manipulation (DML) statements and also trace events, but do not execute stored procedures. Instead, event notifications send information about a server event to a service broker, and are used to log and review changes or activity occurring on the database.
New Statements
New statements | Description |
---|---|
Creates an event notification that sends information about a server event to a service broker. |
|
Removes an event notification from the current database. |
Enhanced Statements
Enhanced statements | Description |
---|---|
Allows for creating a DDL trigger. |
|
Allows for modifying a DDL trigger. |
|
Includes special syntax for removing a DDL trigger from the current database. |
|
Returns information about server or database events. The EVENTDATA function is used inside the body of a DDL trigger or event notification. |
See Also
Reference
Data Definition Language (DDL) Statements (Transact-SQL)
Other Resources
What's New and Enhanced in Transact-SQL (Transact-SQL)