Question

I am trying to use explisit transactions within SSIS. The database I am working with does not have the DTC enabled, so I cannot use SSIS' inbuilt transaction handling.

I have execute sql tasks to initialise, commit and rollback the transaction, however despite having set "RetainSameConnection" to true, I am still getting the below error:

[Execute SQL Task] Error: Executing the query "ROLLBACK;" failed with the following error: "The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Was it helpful?

Solution

It turns out, I had done something really stupid.

My SSIS package, as it turns out was perfect, I had named the transactions and set "RetainSameConnection" to true. Begin/commit/rollback commands were all specified correctly.

My problem was that one of the stored procedures called as part of the SSIS package had a unnamed transaction in it, causing SQL Server to commit everything once the commit in that stored procedure was called.

Resolution was to modify the stored procedure to name the transaction, so that SQL Server treats that transaction as a nested transaction (In theory, I would have thought the second "begin transaction" statement would do this, but for some reason this was not happening).

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top