Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8321615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:04:52+00:00 2026-06-08T23:04:52+00:00

Can someone double-check my trimmed-down example? When the Documents table is updated, I want

  • 0

Can someone double-check my trimmed-down example? When the Documents table is updated, I want it update the EntryDate on the Queue table. However, I don’t want the trigger on the Queue table to fire for THIS PROCESS ONLY. Meaning, if some other process updates the EntryDate on the Queue table while this process would be running, I WOULD want the trigger on the Queue table to fire for that particular transaction. I’m not sure if I need to do any kind of lockout for the below code to ensure no other process gets its toes stepped on. Thanks!

create trigger [dbo].[Documents_trigUpdate] on [dbo].[Documents]
for update
as

begin transaction

alter table [Queue] disable trigger Queue_trigUpdate
update  [Queue] set EntryDate = getdate()
alter table [Queue] enable trigger Queue_trigUpdate

commit transaction

go
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T23:04:53+00:00Added an answer on June 8, 2026 at 11:04 pm

    You’ll want to avoid disabling then re-enabling the trigger, because that will affect all processes and not just the current process. if you put some type of lock, you’ll serialize your code which could become a bottleneck in your system.

    An alternative would be to use the Context_info of the current connection, and change the trigger on the Queue to not execute if a specific context has been set.

    This technique is covered in this article, and an example is provided below:

    -- Creating the queue trigger
    create trigger [dbo].[Queue_trigUpdate] on [dbo].[Queue]
    for update
    as   
    
    declare @Cinfo varbinary(128)  
    select @Cinfo = Context_Info()  
    if @Cinfo = 0x55555  
        return  
    
    print 'Trigger Executed'  
    -- Actual code goes here  
    go
    

    To prevent the trigger from being executed you can do the following:

    create trigger [dbo].[Documents_trigUpdate] on [dbo].[Documents]
    for update
    as
    
    -- Save the original context info    
    declare @originalContextInfo VARBINARY(128)
    set @originalContextInfo = Context_Info()
    
    set Context_Info 0x55555 
    update  [Queue] set EntryDate = getdate()
    
    -- Reset the context info
    set Context_Info @originalContextInfo 
    go
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please explain the purpose of double-negating the reverse var in the below
Can someone please provide an example of how to store, and read xml data
How can I check whether a string represents a long, a double, or just
Can someone pleas explain to me why json which contains a string with double
Can someone share a regex that find all not double-slashed commented println in java
Can someone tell me the regex to see if something is surrounded in double
Can someone explain the difference between these two declarations? double dArray[][]; double dArray[,];
Can someone please give me an example of how public and private headers work?
I was wondering if someone could double check my answers to the following question.
Can someone suggest me a good example or link to select records from MySQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.