Creating an ASE INSTEAD OF Trigger for a View

Create an Adaptive Server Enterprise INSTEAD OF trigger to override the default action of a trigger statement (insert, update, or delete) and perform a user-defined action to update a database view.

Prerequisites 

Be sure the data server that contains the trigger is running, and that you have created and established a connection to the data server.

  1. In Enterprise Explorer, expand the Views folder.
  2. Right-click the view to which to add the trigger, and select New > Instead of Trigger .
  3. Enter the Name.
  4. Select Instead of Update, Instead of Insert, or Instead of Delete to indicate the condition under which the trigger invokes when the associated table is modified. Note that you cannot use Instead of Delete with an if update clause.
  5. (Optional) Enter a description in the Comments field and click Next.
  6. Indicate the execution and save options.
    Option Description
    Generate Script Generate a SQL file for the object.
    Enter or Select the Parent Folder Specify an existing project or create a new project in which to store the SQL file.
    File Name (Optional) Change the default file name in which to save the SQL code.
    Execute Immediately Execute the SQL code immediately. If you do not select this option, you must execute the SQL script later to create the trigger.
    Open in Editor After Creation Create the object and open it in its associated editor.
  7. Click Finish to create the trigger.


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