Last active
April 17, 2019 07:19
-
-
Save martinusso/1278962 to your computer and use it in GitHub Desktop.
Enable/Disable all Triggers on a Firebird database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update | |
rdb$triggers | |
set | |
rdb$trigger_inactive = 1 | |
where | |
rdb$trigger_source is not null | |
and (coalesce(rdb$system_flag,0) = 0) | |
and rdb$trigger_source not starting with 'CHECK' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update | |
rdb$triggers | |
set | |
rdb$trigger_inactive = 0 | |
where | |
rdb$trigger_source is not null | |
and (coalesce(rdb$system_flag,0) = 0) | |
and rdb$trigger_source not starting with 'CHECK' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alter trigger TRIGGER_NAME inactive; | |
alter trigger TRIGGER_NAME active; |
Hi
does not work in FB3
update rdb$triggers set rdb$trigger_inactive = 1 where rdb$trigger_source is not null and (coalesce(rdb$system_flag,0) = 0) and rdb$trigger_source not starting with 'CHECK'
**
SET TERM ^ ;
EXECUTE BLOCK
AS
DECLARE VARIABLE NOMTABLE varchar(100);
DECLARE VARIABLE REQ1 Varchar(100);
BEGIN
for select x.RDB$TRIGGER_NAME from rdb$triggers x where
rdb$trigger_source is not null and (coalesce(rdb$system_flag,0) = 0)
and rdb$trigger_source not starting with 'CHECK' into :NOMTABLE
do
begin
NOMTABLE=trim(NOMTABLE);
req1= 'ALTER TRIGGER ' || :NOMTABLE || ' INACTIVE;';
execute statement req1;
end
END^
SET TERM ; ^
**
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you very much