Sunday, February 19, 2012

Autocommit and Transactions.

Hello,
I need help with some StoredProcedure execution and Transactions.
Here is the scenario:
1) I set Autocommit to OFF
2) I Prepare and Execute an Update Statement without Commiting it. Let's
call this Update Statement UpdStmt1
3) I now need to execute a StoredProc where I have an Update Statement,
let's call this UpdStmt2. I would like to commit UpdStmt2 in my StoredProc
but when I do that my UpdStmt1 is also committed. How can I avoid that from
occuring?
Any help would be appreciated.
Regards,
Sami
[Remove Numbers from e-mail address to use it]When a commit is done, all outstanding changes for the connection are
committed... If you wish to control 2 different transactions(concurrently),
you must have 2 different connections.
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
(Please respond only to the newsgroup.)
I support the Professional Association for SQL Server ( PASS) and it's
community of SQL Professionals.
"Sami" <s8a2m9i1_i5s1l9a6m@.hotmail.com> wrote in message
news:OGONIyBRFHA.3336@.TK2MSFTNGP10.phx.gbl...
> Hello,
> I need help with some StoredProcedure execution and Transactions.
> Here is the scenario:
> 1) I set Autocommit to OFF
> 2) I Prepare and Execute an Update Statement without Commiting it. Let's
> call this Update Statement UpdStmt1
> 3) I now need to execute a StoredProc where I have an Update Statement,
> let's call this UpdStmt2. I would like to commit UpdStmt2 in my StoredProc
> but when I do that my UpdStmt1 is also committed. How can I avoid that
from
> occuring?
> Any help would be appreciated.
> --
> Regards,
> Sami
> [Remove Numbers from e-mail address to use it]
>|||Hello,
Is there any native API for MSSQL which I can use to initialize a separate
Connection to the server?
I don't want to create a new ODBC connection using SQLConnect in my code.
Regards,
Sami
[Remove Numbers from e-mail address to use it]
"Wayne Snyder" <wayne.nospam.snyder@.mariner-usa.com> schrieb im Newsbeitrag
news:%236ffV6BRFHA.3672@.TK2MSFTNGP10.phx.gbl...
> When a commit is done, all outstanding changes for the connection are
> committed... If you wish to control 2 different
transactions(concurrently),d">
> you must have 2 different connections.
> --
> Wayne Snyder MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> (Please respond only to the newsgroup.)
> I support the Professional Association for SQL Server ( PASS) and it's
> community of SQL Professionals.
> "Sami" <s8a2m9i1_i5s1l9a6m@.hotmail.com> wrote in message
> news:OGONIyBRFHA.3336@.TK2MSFTNGP10.phx.gbl...
StoredProc
> from
>

No comments:

Post a Comment