IBM Database Add-Ins for Visual Studio  

Triggers, Designer

In the Triggers view of the IBM® Table Designer or the IBM View Designer, you define the triggers for the IBM database table or view by specifying the time and event to start the trigger, creating the table or view SQL condition, and specifying the action that the trigger performs.


Trigger Definition
In this section, you manage the triggers for the table or view, and set their properties. If multiple triggers should be run at the same time, the triggers are activated in the order in which they occur in the list.
Triggers
Lists the triggers that are defined for the table.
Trigger Name
Type a name for the trigger. Use quotation marks for delimited names. The name cannot exceed 128 characters, and it must be unique among triggers in the database.
Type
For a DB2 database Shows the time and event for the trigger action. The value for this field is a combination of the values that you select for the Time to Trigger Action and Event to Trigger Action properties.

For an IDS database Shows the time for the trigger action. The value for this field is the value that select for the Event to Trigger Action property.

Trigger Properties
Set the property values for the trigger that is selected in the Trigger Name list. An unavailable property is a limitation of the database that you are using.

Select a property to see its description in the box under the properties list. If the description exceeds the size of the box, hover the mouse pointer over the last line of text in the box. After a brief pause, the full description is shown in a ScreenTip.

Trigger Text
In this section, you enter SQL statements for the trigger that is selected in the Trigger Name list. Specify the search condition that determines whether a triggered action is run. Also specify the action that the trigger performs when it is activated.
For a DB2 database
The DB2 SQL syntax for a trigger is:

  CREATE TRIGGER <name>
     <action> ON <table_name>
     <operation>
     <triggered_action>

For examples of SQL code for a DB2 trigger, see CREATE TRIGGER Sample SQL.

Additional information is available in your DB2 documentation. You can also find information in DB2 SQL documentation that is available through The SQL Reference for Cross-Platform Development Web page on developerWorks.

To use the Visual Studio Query Builder to create the trigger text, right-click in this editor, and then select Query Builder on the shortcut menu. When you close the Query Builder, the SQL code in the Query Builder is automatically pasted in this editor at the insertion point.

Columns Selection
In this section, you select the columns to associate with the UPDATE trigger that is selected in the Trigger Name list.

For an IDS database You can also select the columns to associate with the SELECT trigger that is selected in the list.

If the values of any of the selected columns are modified, the trigger will run.

Available Columns
Shows the columns that you can select to activate the trigger action. To move a column to the Selected Columns list, select its name and then click the right arrow button.
Selected Columns
Shows the columns that can activate the trigger action if their value changes. To remove a column from this list, select its name and then click the left arrow button.

See Also

IBM Table Designer | IBM View Designer | Developing IBM Database Tables | Developing IBM Database Views | Managing Database Procedures, Functions, and Objects


.NET Development Forum   DB2 FAQs   IDS FAQs

© Copyright IBM Corporation 2002, 2019. All Rights Reserved.