Hello guys!
I have some troubles with understanding how transactions behave when "RetainSameConnection" is set to TRUE for an OleDb Connection.
Initial data:
- SQL Server:
- SQL Server 2008R2 (RTM);
- A database called "Test" on the Server;
- Three tables utilizing the same structure: tFirst(Col INT NOT NULL), tSecond(Col INT NOT NULL), tThird(Col INT NOT NULL)
- SSIS:
- The package has the next structure:
- Connection Manager to the database "Test" (OLE DB Connection, Provider = Native OLE DB\SQL Server Native Client 10.0)
- ConnManager Properties: RetainSameConnection = TRUE;
- Some "Execute SQL" tasks, a "DataFlow" task and a "Script" task.
- The purpose of the package is to (the pack is to demonstrate the issue and such a structure is selected intentionally):
- truncate table "tSecond";
- truncate table "tThird";
- insert every row from tFirst into the tables "tSecond" and "tThird";
When the package starts, a transaction begins.
1. Within the transaction the tables "tSecond" and "tThird" get truncated.
2. For each row from "tFirst" insert the row into tSecond, tThird;
3. Write @@TRANCOUNT to a local variable "intTranCount", then show "intTranCount";
4. Commit the transaction;
==========================================================
==========================================================
Please, refer to the post below for the tail.
Thanks in advance,
BorkaS