Re: Named Transactions

From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 03/01/04


Date: Mon, 1 Mar 2004 14:17:03 +0100

That is expected. You cannot do rollback using a transaction name to a BEGIN
TRAN. You have to do such rollback to a save point, created with SAVE TRAN.

-- 
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Amin Sobati" <amins@morva.net> wrote in message
news:uRlT%23Y4$DHA.3056@TK2MSFTNGP11.phx.gbl...
> David,
> My problem is not that 'rollback tran b' rolls the whole of transactions
> back, but I get this error:
>
> Server: Msg 6401, Level 16, State 1, Line 3
> Cannot roll back b. No transaction or savepoint of that name was found.
>
> Thanks,
> Amin
>
>
> "David Browne" <davidbaxterbrowne no potted meat@hotmail.com> wrote in
> message news:uwLovZt$DHA.3536@TK2MSFTNGP10.phx.gbl...
> >
> > "Amin Sobati" <amins@morva.net> wrote in message
> > news:ulUz59g$DHA.2512@TK2MSFTNGP11.phx.gbl...
> > > Hi,
> > > Please try this one:
> > > begin tran a
> > >     begin tran b
> > >     rollback tran b
> > > rollback tran a
> > >
> > This is why named transactions don't work: "rollback tran b" rolls back
> > "transaction a".  There really is only one transaction, and however you
> > decorate you rollback, the whole transaction is rolled back.
> >
> > David
> >
> >
>
>


Relevant Pages

  • Re: Named Transactions
    ... rollback an "inner" transaction started with BEGIN TRAN. ... > transaction, but BOL says it must be the name of outermost 'Begin Tran'. ...
    (microsoft.public.sqlserver.programming)
  • Transaction question
    ... commit tran ... I thought that "internal" sql transaction will rollback automatically if the ... the first statement and tran didn't rolled back the first statement. ...
    (microsoft.public.sqlserver.programming)
  • Re: Named Transactions
    ... the 'Rollback Tran' has this synatx: ... transaction, but BOL says it must be the name of outermost 'Begin Tran'. ...
    (microsoft.public.sqlserver.programming)
  • Re: help - transaction control
    ... >transaction to successfully commit before any of the ... If a Rollback is issued anywhere along the ... > ROLLBACK TRAN ...
    (microsoft.public.sqlserver.programming)
  • Re: Classic Nest SP with Transaction Question
    ... enclosing transaction or should begin and commit/rollback its own ... > I echo Ron's points and also have been using an approach very similar to> Tom's method of using a SAVE PT instead of starting a new TRANSACTION if the> ChildSP is called from the ParentSP. ... > The ParentSp now has to ROLLBACK everything up to that point. ... As Ron> mentioned, the ParentSP may have called many child SPs, and performed many> updates up to this point, and all of these need to be rolled back. ...
    (microsoft.public.sqlserver.programming)

Loading