MS SQL Maestro online Help
CLR DDL Triggers
You can build triggers using the SQL Server integration with the .NET Framework common language runtime (CLR).
CLR DDL triggers, like standard triggers, execute stored procedures in response to an event. But unlike standard triggers, they do not execute procedures in response to UPDATE, INSERT, or DELETE statements on a table or view. Instead, they primarily execute in response to data definition language (CLR DDL) statements. These include CREATE, ALTER, DROP, GRANT, DENY, REVOKE, and UPDATE STATISTICS statements. CLR DDL triggers are available since Microsoft SQL 2005.
New CLR DDL Triggers are created within Create CLR DDL Trigger Wizard. In order to run the wizard you should either
• | select the Object | Create Database Object... main menu item; |
• | select the CLR DDL Trigger icon in the Create Database Object dialog |
or
• | select the CLR DDL Triggers list or any object from that list in the explorer tree; |
• | select the Create New CLR DDL Trigger... item from the popup menu |
or
• | open the database in Database Editor and the CLR DDL Triggers tab there; |
• | press the Insert key or select the Create New CLR DDL Trigger... item from the popup menu (alternatively, you may use the corresponding link of the Navigation Bar). |
To create a new CLR DDL Trigger with the same properties as one of the existing CLR DDL Triggers has:
• | select the Object | Duplicate Database Object... main menu item; |
• | follow the instructions of Duplicate Object Wizard. |
|
CLR DDL Triggers can be edited within CLR DDL Trigger Editor. In order to run the editor you should either
• | select the CLR DDL Trigger for editing in the explorer tree (type the first letters of the CLR DDL Trigger name for quick search); |
• | select the Edit CLR DDL Trigger ... item from the popup menu |
or
• | open the database in Database Editor and the CLR DDL Triggers tab there; |
• | select the CLR DDL Trigger to edit; |
• | press the Enter key or select the Edit CLR DDL Trigger item from the popup menu (alternatively, you may use the corresponding link of the Navigation Bar). |
You can change the name of the CLR DDL Trigger using the Rename CLR DDL Trigger dialog. To open the dialog you should either
• | select the CLR DDL Trigger to rename in the explorer tree; |
• | select the Rename CLR DDL Trigger item from the popup menu |
or
• | open the database in Database Editor and the CLR DDL Triggers tab there; |
• | select the CLR DDL Trigger to rename; |
• | select the Rename CLR DDL Trigger item from the popup menu (alternatively, you may use the corresponding link of the Navigation Bar). |
|
To drop a CLR DDL Trigger:
• | select the CLR DDL Trigger to drop in the explorer tree; |
• | select the Drop CLR DDL Trigger item from the popup menu |
or
• | open the database in Database Editor and the CLR DDL Triggers tab there; |
• | select the CLR DDL Trigger to drop; |
• | press the Delete key or select the Drop CLR DDL Trigger item from the popup menu (alternatively, you may use the corresponding link of the Navigation Bar) |
and confirm dropping in the dialog window.
|