You can create a trigger for a table from its property sheet and base
it on a PowerDesigner template, or on a template of your own, or write it from
scratch.
Procedure
- Open the table or view property sheet, and then click the
Triggers tab.
- Click the Add a Row tool to create a new
trigger, enter a name and code, and then click the
Properties tool to open its property sheet.
- Click the Body tab, and select a trigger template (see Trigger Templates) from the Template list. The
time and event fields will be set and the template code copied into the
editor.
Note You can create a trigger by entering code by hand, but we recommend that
you use a template as this will simplify reuse of your code and make your
triggers more portable.
- [optional] Modify the trigger code. You can insert trigger template items (see Trigger Template Items), use PDM variables and
macros and various other tools available from the toolbar (see Writing SQL Code in PowerDesigner).
If you edit the code, then the trigger will be marked as user-defined and will be excluded from most forms of rebuilding (see Rebuilding Triggers).
- Click OK to return to your model.