Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 enable/Disable Triggers

Author  Topic 

CLages
Posting Yak Master

116 Posts

Posted - 2005-04-05 : 15:31:57
hi, a simple big question.

I have one table Named DUPLICATA with several columns (ex 30 columns)
and i Have a Trigger in this table (Update and Delete) that Update
a Table LOGDUPLICATA
in other words each Update ou delete in DUPLICATA i Insert the old record in LOGDUPLICATA
everything works fine.

But i have 7 Diferents Programs one Update 5 columns, othes 7
columns, another one 1 column, etc

in each Program the Triggers is FIRED.

the question?

Is there a way to do something like this?

SET TRIGGERS ON
SET TRIGGERS OFF

BECAUSE IN some Programa i would not like to FIRED the trigger.

tks

C. Lages
full time NetCobol x SQL x Cristal Reports

rfrancisco
Yak Posting Veteran

95 Posts

Posted - 2005-04-05 : 15:37:02
ALTER TABLE YourTable DISABLE TRIGGER ALL
and
ALTER TABLE YourTable ENABLE TRIGGER ALL
Go to Top of Page

CLages
Posting Yak Master

116 Posts

Posted - 2005-04-06 : 08:45:14
In this case none of my programs updating my Table DUPLICATA ,
will fire the Trigger.
I want that in some programs the TRIGGERS is Fired and only one Dont.

in Create Trigger HELP on BOL there are this option

IF UPDATE ( column )

the trigger will be fired only if desired Column is Updated

i am looking for IF UPDATE ( column ) DONT FIRE THE TRIGGER

This is because the table has too many columns than is easier
use the negative.

IF UPDATE ( columnX ) do nothing
otherwise i have to write

IF UPDATE ( columna , Columnb, columnc .....column80 etc )

tks
anyway
C. Lages

Go to Top of Page
   

- Advertisement -