Normally you use the trigger functionality with Data Manipulation Language (DML) commands such as INSERT, UPDATE, and DELETE. Now SQL 2005 introduces new Data Definition Language (DDL) triggers. You can use it to audit schema changes.
Example of DDL Trigger:
CREATE TRIGGER safety ON DATABASE FOR DROP_TABLE, ALTER_TABLE AS PRINT 'You must disable Trigger "safety" to drop or alter tables!' ROLLBACK;
DISABLE TRIGGER safety ON DATABASE;Please refer to MSDN for details: MSDN: Designing DDL Triggers
No comments:
Post a Comment