Triggers Wizard (Sybase ASE)

From DBArtisan
Jump to: navigation, search

Go Up to Sybase ASE Object Wizards

The Triggers Wizard lets you build and submit a CREATE TRIGGER command, selecting a parent object type of table or view, and selecting the triggering events for the trigger. Depending on whether you are creating a trigger for a view or a table, the Wizard generates customizable CREATE TRIGGER syntax as follows:

  • Tables - The wizard generates a FOR INSERT, UPDATE, DELETE trigger code template (all supported Sybase ASE versions)
  • Views - The wizard generates an INSTEAD OF trigger code template (Sybase ASE 15.0.2)

In both cases, you provide the SQL statements that are to make up the body of the FOR or INSTEAD OF trigger.

To create a new trigger using a wizard:

  1. Open a creation wizard for a 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.

Triggers (Sybase ASE) - Properties

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

Setting Description

Parent Type, Parent Owner, and Parent Name

Provide or select details on the target table or view.

Owner and Name

Select the owner and provide a name for the trigger being created.

Fire On Insert, Fire On Update, and Fire On Delete

Enable the events that fire the trigger. An INSERT trigger must be associated with an INSERT statement. For example, if a data load operation doesn’t include an INSERT statement, the trigger won’t be invoked. An UPDATE trigger can be associated with specific columns of the base table and will only be activated if those columns are updated. A DELETE trigger fires automatically after items in the table are deleted.

Note: For triggers with a table parent type, the editor lets you enable and disable the trigger, after creation. For details, see Triggers Editor (Sybase ASE).

Triggers (Sybase ASE) - Definition

Complete the CREATE TRIGGER statement by typing or pasting in content.