Re: Any Way to Defer Triggers?
Posted in 1997
David Mascorro wrote: > > I have a table that has an update trigger defined. There are certain > times when I need to run an update on this table without the trigger > triggering. Is there a command I can execute that will temporarily > turn off the trigger so I can run an update and then turn it back on > afterwords? David, you can disable a trigger with the following command: SET TRIGGERS trigger-name DISABLED Then you do your updates with no triggers happening. Afterward you re-enable the trigger by the command: SET TRIGGERS trigger-name ENABLED However, it will NOT go back and run the trigger code for all the updates you ran in the interim. It couldnt possibly know which rows you had updated. There are ways to do what you want, if you are willing to change your whole approach and use a store procedure to do these extra operations as a batch. Also, timestamp your records so the procdure knows what needs the "trigger" action. -- -- Jake (In pursuit of undomesticated aquatic avians) +----------------------------------------------------------+ |Aside from that, how did you enjoy the play, Mrs. Lincoln?| +----------------------------------------------------------+