The IBM® Database Add-Ins for Visual Studio
simplify the process of creating triggers.
You can use one of the following tools to create an IBM database trigger:
The IBM Table Designer, which generates the trigger as
part of a table definition in the Server Explorer.
The IBM View Designer, which generates the trigger as
part of a database view definition in the Server Explorer.
The Visual Studio Code Editor, with which you can manually
insert the SQL statement in the trigger script file.
With the designers, you provide information about
the trigger, specify the time and event to start the trigger,
create the table or view SQL condition, specify the action that
the trigger will perform, and specify script options for the trigger.
To create a trigger by using a designer:
Start creating a table or a view, or changing a table or view
definition by using the IBM Table Designer or the IBM View
Designer.
From the associated designer menu, select Triggers.
The Triggers view of the designer is displayed.
Add one or more triggers and define the properties and columns
for each trigger.
For detailed information about fields in the Triggers view, see
Triggers, Designer.
Continue creating the table or view, or changing the table or view
definition.
To create a trigger by using the editor:
In the Solution Explorer, right-click the Triggers folder
under your IBM database project, select Add on the shortcut menu,
and then select New Item.
The Add New Item window opens.
In the Categories list, select Triggers.
In the Templates list, select Trigger Script.
In the Name field, type a name for the new trigger file,
and then click Add.
A new trigger file with a basic structure is created and added to your
project.
Use the editor to make changes to the trigger.
To save your changes, select File, and then select
Save [file name].