Firebird Sql Tips… Enable or Disable all trigger via sql
To enable and disable all triggers of a database i do two procedure :
Enabling all database trigger:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
create procedure SP_ENABLE_ALL_TRIGGER as begin /* Procedure Text */ update RDB$TRIGGERS set RDB$TRIGGER_INACTIVE=0 where RDB$TRIGGER_NAME in( select A.RDB$TRIGGER_NAME from RDB$TRIGGERS A left join RDB$CHECK_CONSTRAINTS B ON B.RDB$TRIGGER_NAME = A.RDB$TRIGGER_NAME where ((A.RDB$SYSTEM_FLAG = 0) or (A.RDB$SYSTEM_FLAG is null)) and (b.rdb$trigger_name is null) AND (NOT(A.RDB$TRIGGER_NAME LIKE 'RDB$%')) ); suspend; end |
Disabling all database trigger:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
create procedure SP_DISABLE_ALL_TRIGGER as begin update RDB$TRIGGERS set RDB$TRIGGER_INACTIVE=1 where RDB$TRIGGER_NAME in( select A.RDB$TRIGGER_NAME from RDB$TRIGGERS A left join RDB$CHECK_CONSTRAINTS B ON B.RDB$TRIGGER_NAME = A.RDB$TRIGGER_NAME where ((A.RDB$SYSTEM_FLAG = 0) or (A.RDB$SYSTEM_FLAG is null)) and (b.rdb$trigger_name is null) AND (NOT(A.RDB$TRIGGER_NAME LIKE 'RDB$%')) ); suspend; end |
Una risposta.
[…] But is this safe to do in Firebird 2.5? Or does the official ACTIVE / INACTIVATE command do anything else in the background? (I found the idea: here) […]
I commenti sono chiusi.