Welcome Guest Search | Active Topics | Members | Log In | Register

escaping a transaction Options · View
David Portas
Posted: Sunday, October 21, 2007 7:45:10 PM


Rank: Guest
Groups: Guest

Joined: 9/17/2007
Posts: 11,670
Points: -1,200
Date parsed: 21/10/2007 19:45:10
Date: Mon, 22 Oct 2007 02:45:10 -0700

On 21 Oct, 22:21, "valentin tihomirov" <V_tihomi...@best.ee> wrote:
> The code is
>
> proc1
> begin tgan
> insert
> exec proc2
> commit tran
> end
>
> proc2
> begin tran
> commit tran
> exec proc3 -- do not want to it be in the proc1's tran
> end
>
> The desire is to escape the execution of proc3 from the transaction started
> by proc1.
>
> If you like, the apology for the decision is: The proc3 does some complex
> things (a couple of records are inserted, deleted, updated). This must be
> done 1) atomically (all or nothing) but the operations are 2) expensive and
> 3) must always commit. So, for performance reasons, I have decieded to do it
> transceding the transaction. In case of failure, which may happen only
> because of system shut down, the state can be restored manually.


proc1
begin tran
insert
commit tran
exec proc2
end

--
David Portas

valentin tihomirov
Posted: Monday, October 22, 2007 3:21:38 AM


Rank: Guest
Groups: Guest

Joined: 9/17/2007
Posts: 11,670
Points: -1,200
Date parsed: 22/10/2007 03:21:38
Date: Mon, 22 Oct 2007 00:21:38 +0300

The code is

proc1
begin tgan
insert
exec proc2
commit tran
end

proc2
begin tran
commit tran
exec proc3 -- do not want to it be in the proc1's tran
end

The desire is to escape the execution of proc3 from the transaction started
by proc1.

If you like, the apology for the decision is: The proc3 does some complex
things (a couple of records are inserted, deleted, updated). This must be
done 1) atomically (all or nothing) but the operations are 2) expensive and
3) must always commit. So, for performance reasons, I have decieded to do it
transceding the transaction. In case of failure, which may happen only
because of system shut down, the state can be restored manually.


Ekrem Önsoy
Posted: Monday, October 22, 2007 1:56:44 PM


Rank: Guest
Groups: Guest

Joined: 9/17/2007
Posts: 11,670
Points: -1,200
Date parsed: 22/10/2007 13:56:44
Date: Mon, 22 Oct 2007 10:56:44 +0300

I'm not sure I completely understand your question, however you may want to
take a look at the following stuff.

Check out ROLLBACK TRAN
http://msdn2.microsoft.com/en-us/library/ms181299.aspx

and TRY ... CATCH (SQL 2005 only)
http://msdn2.microsoft.com/en-us/library/ms175976.aspx

--
Ekrem Önsoy



"valentin tihomirov" <V_tihomirov@best.ee> wrote in message
news:eNi74gCFIHA.3400@TK2MSFTNGP03.phx.gbl...
> The code is
>
> proc1
> begin tgan
> insert
> exec proc2
> commit tran
> end
>
> proc2
> begin tran
> commit tran
> exec proc3 -- do not want to it be in the proc1's tran
> end
>
> The desire is to escape the execution of proc3 from the transaction
> started by proc1.
>
> If you like, the apology for the decision is: The proc3 does some complex
> things (a couple of records are inserted, deleted, updated). This must be
> done 1) atomically (all or nothing) but the operations are 2) expensive
> and 3) must always commit. So, for performance reasons, I have decieded to
> do it transceding the transaction. In case of failure, which may happen
> only because of system shut down, the state can be restored manually.
>

Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.1 (NET v2.0) - 9/10/2007
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.
This page was generated in 0.064 seconds.