DDL Triggers
SQL Server supports data definitin language (DDL) triggers, allowing you to trap DDL operations and react to them. You can thus roll back the DDL activity. DDL triggers work synchronously, immediately after the triggering event, similar to the way that DML triggers work. DDL triggers can be database-wide and can react to certain types of DDLs or all DDLs.
The cool thing about DDL triggers is that you can get context information from querying the EVENTDATA function. Event data is an XML payload of data about what was happening when your DDL trigger ran (including information about the time, connection, and user), the type of event that was fired, and other useful data. To get at EVENTDATA data, you have to use the EVENTDATA function ...
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