disabling triggers

disabling triggers

Post by Brad Irb » Sat, 05 Feb 2000 04:00:00



You could use a cursor to cycle through a list of all tables to disable all
triggers on each table.

ALTER TABLE table
 {ENABLE | DISABLE} TRIGGER
        {ALL | trigger_name[,...n]}

Wrap this in a stored procedure and it becomes "_a_ SQL Statement"  :)

Brad Irby
Building Block Software


Quote:> I'd like to be able to disable or enable all the triggers in my database.
> Is there a SQL statement that can do this?

> Thanks,
> George

 
 
 

1. Disable Trigger within a Trigger

I have the following delete trigger on my parent table which basically cascades through all of my child tables deleting any child data.  I also have delete triggers on the child tables that I do not want to fire if the parent record is deleted, so I'm disabling the delete triggers on all of my child tables.  This isn't working though and the delete triggers on the child tables are executing.  What am I missing?  Any help would be greatly appreciated.

CREATE TRIGGER trProspectDelete ON dbo.tblProspect
FOR DELETE
AS

ALTER TABLE tblProspectAddress DISABLE trigger trProspectAddressDelete
ALTER TABLE tblProspectChild DISABLE trigger trProspectChildDelete

DELETE tblProspectAddress FROM tblProspectAddress, deleted WHERE deleted.zProspectID = tblProspectAddress.zProspectID
DELETE tblProspectChild FROM tblProspectChild, deleted WHERE deleted.zProspectID = tblProspectChild.zProspectID

ALTER TABLE tblProspectAddress ENABLE trigger trProspectAddressDelete
ALTER TABLE tblProspectChild ENABLE trigger trProspectChildDelete

2. New downloads at Oracle-Home.Com

3. Enabling/disabling triggers on MS SQL 2000

4. Oracle/Sybase? Which one?

5. Disable Triggers?

6. ESQL where can I get it from?

7. Disabling Triggers

8. How to disable triggers through DTS

9. Enable and Disable Trigger

10. Disable Triggers

11. Disabling Triggers

12. Disable Trigger