Database Triggers Wizard (SQL Server)

From DBArtisan
Jump to: navigation, search

Go Up to Microsoft SQL Server Object Wizards

This wizard builds and submits a CREATE TRIGGER... ON DATABASE statement, letting you create a DDL trigger with database scope, that fires in response to selected DDL events. The wizard builds basic syntax only, letting you provide the actions and conditions SQL making up the main body of the trigger.

Note: Before working with database triggers, consult Microsoft SQL Server documentation for general information on DDL triggers as well as specifics such as FOR/AFTER argument details, valid actions and conditions, and supported events. For more information, see Accessing Third Party Documentation.

To create a new database trigger using a wizard:

  1. Open a creation wizard for a database trigger. For details, see Opening an Object Wizard.
  2. Use the following topics as a guide to setting properties and performing tasks as you pass through the wizard panels:
  3. Finally, use the Execute button to create the object.
    Note: In order to fire in response to specified events, a database trigger must be enabled. For information on enabling and disabling a database trigger, see Database Triggers Editor (SQL Server) and Change Status (SQL Server DDL triggers).

Database Triggers (SQL Server) - Properties

When creating or editing a database trigger, this tab/panel lets you work with the following settings:

Setting Description

Name

Provide a name for the DDL trigger.

Trigger Timing

Use this control to specify a FOR/AFTER argument option. The specific events for the argument are provided on the Trigger Events tab/panel.

Encrypted

Select this check box to add a WITH ENCRYPTION argument to the generated DDL. This prevents the trigger from being published as part of a SQL Server replication.

Database Triggers (SQL Server) - Trigger Events

When creating or editing a database trigger, this tab/panel lets you specify the FOR/AFTER argument appearing in the generated CREATE TRIGGER... ON DATABASE syntax. For each event that is to fire this trigger, select the associated check box.