Subject Re: [firebird-support] Disable trigger?
Author Thomas Steinmaurer
> I have created triggers to log inserts, updates, and deletes on a good number of tables. The purpose is to log who changes what, and to be able to track changes to certain important fields, regardless of who changes them. However, I don't need to log certain program-created updates. For example certain fields are automatically updated each day for hundreds or even thousands of records. Therefore, the logging triggers created hundreds or even thousands of log entries each day that are just clutter. Is there a way my stored procedure can disable a trigger, do its job, and then re-enable?
>
> I've tried:
>
> ALTER TRIGGER MyTrigger ENABLE;
> do some work...
> ALTER TRIGGER MyTrigger ENABLE;
>
> Of course, these commands are not legal.

Either don't include the fields in the log trigger at all or work with
user-defined conditions inside the trigger body. E.g. you could run the
certain stored procedures with a different Firebird user or you could
use user-defined context variables via RDB$SET_CONTEXT, RDB$GET_CONTEXT
to implement some kind of conditional executing of your trigger body.


--
With regards,

Thomas Steinmaurer
Upscene Productions
http://www.upscene.com
http://blog.upscene.com/thomas/

Download LogManager Series, FB TraceManager today!
Continuous Database Monitoring Solutions supporting
Firebird, InterBase, Advantage Database, MS SQL Server
and NexusDB!