Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 17th, 2006, 09:14 AM
Authorized User
 
Join Date: Sep 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trigger Atomicity

Hi

i have a FOR UPDATE trigger in one of my tables

What i do is after the update is done, i update one of the columns of the table

Is it possible, that between the time the update is done and the time the trigger starts (and finishes) someone changes something in the same row?

Or does the DBMS lock everything up from the time the update starts and the trigger finishes

Thank you

 
Old February 17th, 2006, 09:56 AM
Authorized User
 
Join Date: Oct 2004
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don’t know the answer to the question but I suspect it could happen. If you wish to prevent I would wrap the update and trigger in a single transaction to ensure integrity.
 
Old February 18th, 2006, 06:02 PM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 146
Thanks: 0
Thanked 1 Time in 1 Post
Default

The trigger fires as part of the same transaction that modified the row. Consequently, the rows affected are locked until all of the triggers are fired and executed <bad pun>I know that sounds harsh, but some RDBMS believe in the Death Penalty, not just terminating employment</bad pun>.

Sidenote: if you rollback during the trigger then the whole transaction is rolled back

David Lundell
Principal Consultant and Trainer
www.mutuallybeneficial.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Trigger sumith ASP.NET 1.0 and 1.1 Professional 0 March 21st, 2007 12:44 AM
Trigger fhillipo SQL Server 2000 1 March 20th, 2007 07:44 AM
Trigger Help monika.vasvani SQL Language 2 March 1st, 2007 06:59 AM
Trigger realgone_ SQL Language 4 January 27th, 2005 11:49 AM
Using instead of trigger dmr999 SQL Server 2000 1 November 29th, 2003 02:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.