Altering triggers

You can modify an existing trigger using either Sybase Central or Interactive SQL. You must be the owner of the table on which the trigger is defined, or be DBA, or have ALTER permissions on the table and have RESOURCE authority.

In Sybase Central, you cannot rename an existing trigger directly. Instead, you must create a new trigger with the new name, copy the previous code to it, and then delete the old trigger.

Alternatively, you can use an ALTER TRIGGER statement to modify an existing trigger. You must include the entire new trigger in this statement (in the same syntax as in the CREATE TRIGGER statement that created the trigger).

To alter the code of a trigger (Sybase Central)

  1. Connect to the database as a user with DBA authority or as the owner of the trigger.

  2. In the left pane, double-click Triggers.

  3. Select the trigger.

  4. Use one of the following methods to alter the trigger:

    • In the right pane, click the SQL tab.
    • Right-click the trigger and choose Edit In New Window.
      Tip

      You can open a separate window for each procedure and copy code between triggers.

    • To add or edit a procedure comment, right-click the trigger and choose Properties.

      If you use the Database Documentation Generator to document your SQL Anywhere database, you will have the option to include these comments in the output. See Documenting a database.

To alter the code of a trigger (SQL)

  1. Connect to the database as a user with DBA authority or as the owner of the trigger.

  2. Execute an ALTER TRIGGER statement. Include the entire new trigger in this statement.

See also