Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Table Triggers

A Table trigger is SQL or code that is automatically executed as a result of data being modified in a database Table. Triggers are highly customizable and can be used in many different ways; for example, they could be used to stop certain database activities from being performed during business hours, or to provide validation or perform deletions in secondary Tables when a record in the primary Table is deleted.

In Enterprise Architect, a Table trigger is modeled as a stereotyped operation and managed using the Table's Constraints screen.

Access Tools | Database Builder | Click on Table name > Constraints | Right-click | Add New Constraint (Ctrl+N)       or

In diagram or Project Browser | Right-click on Table | Features & Properties | Operations > Constraints | Add New Constraint (Ctrl+N)   or

Click on a Table: F10

Create a Table Trigger

Step

Action

See also

1

On the 'Constraint' tab, a new constraint is automatically created and assigned the default constraint name and a Type of index.

Overtype the constraint name with a name that identifies the constraint as a trigger, such as TRG_OnCustomerUpdate. (The TRG_ prefix is optional.)

Database Table Constraints

2

In the 'Type' field, change the value from 'index' to 'trigger'.

3

In the 'Properties' panel, for the Statement property type in the complete SQL statement (including CREATE TRIGGER) that will define the Trigger.

If the condition is long, click on the button to display a SQL editor (with syntax highlighting).

4

The properties Trigger Time and Trigger Event are currently information-only values and are not used in DDL generation.

Delete a Table Trigger

If you do not want to keep a trigger, either:

  • Right-click on it in the list and select Delete constraint '<name>', or
  • Click on the item and press Ctrl+D

The trigger is immediately deleted.

Learning Center topics

  • Alt+F1 | Enterprise Architect | Database Engineering | Physical Data Model | Create Trigger