You are here:   Home
Register   |  Login

Captured Technology - Blog

Minimize

Updating a Table Without Firing the Trigger

by Steve Patterson on Thursday, April 09, 2009 9:12 AM

Updating a Table Without Firing the Trigger

Having a Trigger on a SQL Server table is a great feature that can keep data in sync and update records automatically when needed but what about those cases where you want to run an update command and don't want the trigger to fire. I came across a situation where an update timestamp on a record was being displayed on a web page and I wanted a specific date to show up. The easiest way to fix this issue was to disable the trigger, update the update timestamp on the record, and then enable to trigger. Here is the code:

 

DISABLE TRIGGER [dbo].[Document_Update] ON [Document]
 
UPDATE [Document]
   SET [update_timestamp] = '2009-04-01 10:00:00.950'
 WHERE document_filename like '%some_unique_value%'
 
ENABLE TRIGGER [dbo].[Document_Update] ON [Document]

Author
Steve Patterson

Latest technology news.

1 comment(s) so far...

Anonymous 5/11/2012

They have shared the updating table we can be know that and used in this technology we can be know that and used also so nice good technology. This is informative and knowledgeable technology.

FaceBook

Minimize

Mobile Version

Minimize
Add CapturedTech - Technology Mippin widget

Translate

Minimize

Sponsors

Minimize
Call Now: 877-672-3078

Categories

Minimize

Bloggers

Minimize
Bloggers - Meet Millions of Bloggers

u comment, i follow