Disabling Triggers

Advantage Database Server v8.1: A Developer’s Guide

by Cary Jensen and Loy Anderson

  © 2007 Cary Jensen and Loy Anderson. All rights reserved.

  Previous topic Next topic  

Beginning with Advantage 8, it is possible to disable triggers. This can be done for the entire data dictionary, a specific connection, a specific table, or on a trigger-by-trigger basis. Normally, disabling triggers is something that an administrator will do during a maintenance operation. For example, you might want to disable an INSTEAD OF INSERT trigger prior to importing a large amount of data into one of your tables.

With the exception of certain maintenance operations, triggers should normally not be disabled. The value of triggers is that they always execute in response to record-level events, regardless of which client is performing the operation (at least with ADT tables). When you disable a trigger, those operations are no longer guaranteed.

When disabling triggers for a maintenance operation, you will normally disable triggers only on the connection through which the maintenance operation will be performed, enabling triggers once again or simply dropping the connection after the maintenance operation is complete. This approach ensures that the triggers are still enabled for all other users of the database.

To disable triggers on a specific connection, call the sp_DisableTriggers system stored procedure, passing NULL in the first parameter and False in the third parameter. See the Advantage help for details about using sp_DisableTriggers.

To disable triggers for the entire data dictionary, right-click the data dictionary node in the Connection Repository and select Properties. From the Advanced page of the Data Dictionary properties dialog box, check the Disable Triggers checkbox.

To disable only a single trigger, right-click the table to which the trigger is assigned in the TABLES node of your administrative data dictionary connection and select Triggers. Use the Name dropdown menu to select the trigger you want to disable. With that trigger displayed, check the Disabled checkbox. Enable the trigger once again by unchecking this checkbox.

To disable triggers for an entire table, right-click the table and select Properties to display the Table Designer. Select the Table Properties tab, and then set the Triggers Disabled option to Yes. Set Triggers Disabled to No to re-enable the table's triggers.

 

In the next chapter you will learn how to back up your data using the ADS online backup capabilities.