Skip to content

Instantly share code, notes, and snippets.

@martinusso
Last active April 17, 2019 07:19
Show Gist options
  • Save martinusso/1278962 to your computer and use it in GitHub Desktop.
Save martinusso/1278962 to your computer and use it in GitHub Desktop.
Enable/Disable all Triggers on a Firebird database
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'
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'
alter trigger TRIGGER_NAME inactive;
alter trigger TRIGGER_NAME active;
@Mohamed1973
Copy link

Mohamed1973 commented Apr 17, 2019

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