Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Enable/Disable ALL Triggers


This question is answered.


Permlink Replies: 2 - Last Post: Jan 5, 2018 2:32 AM Last Post By: Melissa Torn Threads: [ Previous | Next ]
Melissa Torn

Posts: 143
Registered: 4/30/09
Enable/Disable ALL Triggers  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 3, 2018 8:24 PM
Is there a way to Enable (Active) and Disable(InActive) ALL Triggers ?

Thank You
Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: Enable/Disable ALL Triggers
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 4, 2018 10:15 AM   in response to: Melissa Torn in response to: Melissa Torn
On 1/3/2018 11:24 PM, Melissa Torn wrote:
Is there a way to Enable (Active) and Disable(InActive) ALL Triggers ?

Thank You

This will get you all the active user defined triggers

Select rdb$trigger_name
from rdb$triggers
where rdb$system_flag = 0 and
rdb$flags = 1 and
rdb$trigger_inactive = 0

from that list it is easy to build a script to turn them all off then all on and
execute the script. You can even have the SQL do it like

Select 'ALTER TRIGGER ' || rdb$trigger_name || ' inactive;'
from rdb$triggers
where rdb$system_flag = 0 and
rdb$flags = 1 and
rdb$trigger_inactive = 0

and

Select 'ALTER TRIGGER ' || rdb$trigger_name || ' active;'
from rdb$triggers
where rdb$system_flag = 0 and
rdb$flags = 1 and
rdb$trigger_inactive = 0

Build both scripts first before you turn things off or you won't know what needs
to be turned back on. This makes sure that if you might have some triggers off
already and you accidentally want them turned back on when turning on the mass
you turned off.

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)
Melissa Torn

Posts: 143
Registered: 4/30/09
Re: Enable/Disable ALL Triggers  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 5, 2018 2:32 AM   in response to: Jeff Overcash (... in response to: Jeff Overcash (...
ThankYou SO MUCH Jeff
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02