SQLIS Wiki
User: Guest
Login
Wiki Home Wiki Home
Topic Index Topic Index
Edit Edit
Print View Print View
What's New What's New
Search
RSS 2.0 RSS 2.0
Recent Topics
NativeTransactions NativeTransactions
0xC0047040 0xC0047040

Current Version:
11/7/2005 3:48 AM AllanMitchell
Native Transactions
.

Ok So we are all familiar I think with MSDTC transactions but what if we want to implement a good old native transaction?

 BEGIN TRANSACTION
  <code>
 COMMIT/ROLLBACK TRANSACTION

Here is how you do it.

Given a piece of workflow that looks like this

Reading from left to right we start a transaction, insert some good data and then we come to the Pivot Task. It is this task that will decide if we rollback or we commit.

The only thing we need to do is make sure that each ExecuteSQL Task uses the same connection manager and on that Connection Manager we set RetainSameConnection = true

The question that immediately pops up here is "So where is the ROLLBACK TRANSACTION on failure of the Pivot Task?"

Let's make sure the Pivot task fails. Well we are are lucky in that a ROLLBACK is issued for us. Here is what happens in Profiler.

 BEGIN TRANSACTION
 go
 INSERT A VALUES(1)
 go
 INSERT A VALUES('A') 
 go
 ROLLBACK TRANSACTION
 go
Copyright © 2001-2005 SQLDTS.com. All Rights Reserved. TermsOfUse, Powered by FlexWiki 1.8.0.1677