I don't know even if is it possible to do this.
But I didn't succeed looking in the manual.
I'm using SQL ANYWHERE 11.
asked 03 Feb '10, 19:50
There is no way to programmatically disable a trigger temporarily. Note that you can disable triggers on the server command line using the -gf command line option (but this is not going to help you here).
One method that may solve your problem is to let the trigger fire but programmatically make the operation a no-op. One method to doing this would be to wrap the logic within your trigger code with, say, a test of a connection variable.
Note that my example checks that the global connection variable exists before attempting to use the variables value. The non-existing variable implies that triggers are enabled.
Then when you want to disable the triggers temporarily, you would do:
If you were going to do this a lot, you could create two procedures and one function:
Now you can use:
and within your trigger use:
Note: If you are using a row level trigger then you can add a WHEN clause containing the condition and leave the trigger code as is. ( Thanks to TDuemesnil for making this suggestion! )
In extension to Mark if you do not want to clutter your trigger logic you could extend the trigger definition to test the condition
answered 04 Feb '10, 11:10
I know this is an old post but I thought it was worth adding that you can disable all the triggers in code using:
You can find the option details in the docs for v11: http://dcx.sybase.com/1100/en/dbadmin_en11/fire-triggers-option.html
Also for what it is worth i found the same in the v7 and v9 docs as well.