Trigger

The Trigger category is located in the Root > Script > Objects category, and can contain the following items that define how triggers are modeled for your DBMS.

Item

Description

[Common items]

The following common object items may be defined for triggers:

  • AfterCreate, AfterDrop, AfterModify

  • BeforeCreate, BeforeDrop, BeforeModify

  • Create, Drop

  • Enable, EnableOwner

  • Maxlen

  • ModifiableAttributes

  • ReversedQueries, ReversedStatements

  • SqlAttrQuery, SqlListQuery

For a description of each of these common items, see Common object items.

DefaultTrigger Name

Specifies a template to define default trigger names.

Example (SQL Anywhere 10):

%TEMPLATE%_%.L:TABLE%

EnableMulti Trigger

Enables the use of multiple triggers per type.

Event

Specifies a list of trigger event attributes to populate the Event list on the Definition tab of Trigger property sheets.

Example:

Delete
Insert
Update

EventDelimiter

Specifies a character to separate multiple trigger events.

ImplementationType

Specifies a list of available trigger template types.

Time

Specifies a list of trigger time attributes to populate the Time list on the Definition tab of Trigger property sheets.

Example:

Before
After

Trigger Comment

Specifies a statement for adding a trigger comment.

UniqName

Specifies whether trigger names must be unique within the global scope of the database. The following settings are available:

  • Yes – Trigger names must be unique within the global scope of the database.

  • No – Trigger names must be unique per object

UseErrorMsg Table

Specifies a macro for accessing trigger error messages from a message table in your database.

Enables the use of the User-defined radio button on the Error Messages tab of the Trigger Rebuild dialog box (see Data Modeling > Building Data Models > Triggers and Procedures > Generating Triggers and Procedures > Creating User-Defined Error Messages).

If an error number in the trigger script corresponds to an error number in the message table, the default error message of the .ERROR macro is replaced your message.

Example (ASE 15):

begin
 select @errno  = %ERRNO%,
    @errmsg = %MSGTXT%
 from %MSGTAB%
 where  %MSGNO% = %ERRNO%
 goto error
end

Where:

  • %ERRNO% - error number parameter to the .ERROR macro

  • %ERRMSG% - error message text parameter to the .ERROR macro

  • %MSGTAB% - name of the message table

  • %MSGNO% - name of the column that stores the error message number

  • %MSGTXT% - name of the column that stores the error message text

See also UseErrorMsgText.

UseErrorMsg Text

Specifies a macro for accessing trigger error messages from the trigger template definition.

Enables the use of the Standard radio button on the Error Messages tab of the Trigger Rebuild dialog box.

The error number and message defined in the template definition are used.

Example (ASE 15):

begin
 select @errno  = %ERRNO%,
    @errmsg = %MSGTXT%
 goto error
end

See also UseErrorMsgTable.

ViewTime

Specifies a list of available times available for trigger on view.