Running a Trigger

Run a trigger to obtain SQL results from the database.

  1. In the Databases folder in Enterprise Explorer, under the database connection profile, expand the navigation tree for the appropriate database and schema owner.
    Database Steps
    From an ASE connection profile
    1. Expand the Databases folder.
    2. Expand the tree for a database and then the tree for the appropriate schema owner.
    From a SQL Anywhere or Sybase IQ connection profile
    1. Expand the tree for a database.
    2. Expand the Schemas folder and then the tree for the appropriate schema owner.
  2. Expand the Tables folder, the table where the trigger is located, and then the Triggers folder.
  3. Right-click the trigger and select Run.
  4. Make sure the Trigger field in the Type frame is selected.
  5. To modify the trigger SQL, click the SQL... button, and select Insert, Update, or Delete.
  6. Construct a query with Visual SQL, and click OK.
  7. Click Apply to apply the value changes to the launch configuration.
  8. Click Run to run the trigger.

    View results in SQL Results view.

  9. Open the Triggers folder and double-click the trigger name.

    Its SQL code appears in the Procedural Object Editor.

  10. Place the cursor in the code where you want to enter new values into the trigger's SQL code.
  11. Right-click to select Visual SQL and select Insert, Update, or Delete.

    The SQL Select Table dialog appears.

  12. Select a table and click Open.

    The Column Values page (insert, update or delete) appears.

  13. In the Column Name field, insert the values that you want the trigger to use by clicking on the column name. Use the buttons to insert a Null value; Select to return the values to be inserted by the insert statement; and Clear to remove any entered insert values. Add arguments as appropriate. If you selected Delete, you see a list of columns in the table; use the various clause tabs to modify the Delete trigger.
    Statement Action
    insert All column names appear. In the Column Name field, enter values that you want the trigger to insert.
    update Choose the columns whose values you want the trigger to update by single-clicking the column name. Enter values in the Column Name field.
    delete No action at the statement level. Use the Where and Having clause tabs to limit the rows the trigger deletes.

    Use the drop-down lists on the Where and Having tabs to delimit the rows you want the trigger to insert, update, or delete. Manipulate the columns in the Sort and Group clauses to organize the ways in which results are returned. See Using Visual SQL to Edit a Procedural Object to obtain more information about clauses. You can preview the code you have created by selecting the Preview tab. When you are finished, click OK to return to the Modify Attributes and Launch page.

    1. &&& need substeps for step 6.
  14. Right-click in the Procedural Object Editor and select Run to run the trigger.
Related concepts
Run Overview
Related tasks
Creating a Launch Configuration for Routine Procedural Objects
Running a Stored Procedure
Running a User-Defined Function
Running a SQL Anywhere or Sybase IQ Event
Executing a SQL File
Viewing SQL Results
Running a Procedural Object
Running a Procedural Routine Object Using a Launch Configuration
Creating a Launch Configuration for Routine Procedural Objects
Running a Stored Procedure
Running a User-Defined Function
Running a SQL Anywhere or Sybase IQ Event
Viewing SQL Results


Created June 25, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com