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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-01-09 : 07:17:00
|
| Steve writes "Hi,I have a table with a trigger, which works just fine. I would like to write a stored procedure that when called, does not execute the trigger. Is this possible? Basically, I want to temporarily disable a trigger for certain types of inserts and updates. The question is simple but I can't seem to find anything to do the job.Any help is much appreciated.All the best,Steve" |
|
|
rihardh
Constraint Violating Yak Guru
307 Posts |
Posted - 2003-01-09 : 07:29:13
|
| Steve, open BOL on TRIGGERS and then on IF statements. You'll see two things: 1.it's not the procedure which fires the trigger and2.conditions which control the firing of the trigger are best used in the trigger itselfThe rest is up to you... |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-01-09 : 08:11:08
|
| As rihardh the trigger is associated with the table so you can't cause it to fire or not depending on the call.In the alter table statement there is a disable trigger option but this will affect all updates - not to be used in an on-line system.In the SP you could put the spid and logon time in a table and check these at the beginning of the trigger to decide whether to do anything.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|