Define SQL Server Database Triggers

Use the SQL Server Database Trigger Editor to define the stored procedures that exist for a database in a SQL Server 2005/2008 physical model.

Note: You cannot use the SQL Server Database Trigger Editor until you have created a SQL Server database object in your model.

To define SQL Server database triggers

  1. Click Triggers, Database on the Database menu.

    The SQL Server Database Trigger Editor opens.

  2. Select the database from the Database drop-down that contains the trigger that you want to define, select the trigger, and work with the following options:

    Note: Click New <New> icon in property editors on the toolbar to create a new database trigger.

    Name

    Displays the database trigger name. You can change the trigger name in this field.

    Generate

    Generates SQL during forward engineering. Clear the check box if you do not want to generate SQL.

    Trigger Timing

    Specifies when the database trigger is executed. Make a selection from the drop-down list.

  3. Click the General tab and work with the following options:
    Trigger Events

    Specifies the database trigger events. If any of the selected events, or actions, occur in the database, the database trigger is executed. Select or clear the check boxes for the event groups and events that execute the database trigger.

    Type

    Specifies the permission level in effect when the database trigger is executed.

    Select User

    Specifies the user whose permissions are in effect for the execution of the database trigger.

    Note: This option is only available if you have selected the Execute As User option in the Type drop-down list.

    Enabled State

    Specifies whether the database trigger is enabled or disabled.

    Encryption

    Specifies that the database trigger is encrypted in the database.

    Not for replication

    Specifies that the database trigger is not invoked as part of database replication.

  4. Click the Code tab to define the code type for the database trigger.
  5. Click the Expanded tab to view expanded code for the database trigger.
  6. (Optional) Click the Comment tab and enter any comments that you want to associate with the database trigger.
  7. (Optional) Click the UDP tab to work with user-defined properties for the database trigger.
  8. Click Close.

    The database trigger is defined and the SQL Server Database Trigger Editor closes.

More information:

SQL Server Physical Property Editors

Define the Code Type for an Object in a SQL Server Property Editor

View Expanded Code in a Property Editor

Add a Comment in a Property Editor

Add a UDP in a Physical Property Editor