SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


rolling back data in SSIS package


rolling back data in SSIS package

Author
Message
BIsweet
BIsweet
Valued Member
Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)

Group: General Forum Members
Points: 50 Visits: 72
Hi, I have an SSIS 2008 package which will call a stored procedure and store the data into a variable . My stored procedure is actually inserting data into a couple of tables and then selecting few fields as a result to the SSIS package.

Now, what I want is if my SSIS package fails for any reason, I want my package to rollback the data inserted into the tables in my stored procedure. Can any one please let me know how to achieve this ?

Many Thanks
rburko
rburko
Old Hand
Old Hand (339 reputation)Old Hand (339 reputation)Old Hand (339 reputation)Old Hand (339 reputation)Old Hand (339 reputation)Old Hand (339 reputation)Old Hand (339 reputation)Old Hand (339 reputation)

Group: General Forum Members
Points: 339 Visits: 365
There are a couple of ways you can do this:

1. You can have SSIS run under a transaction. Go to the package properties and set the transactionoption property under transactions to "required." Any step that you want as part of the transaction, set its transactionoption to "supported." If you just have one or two steps that need to run under transaction, set transactioption in the step that runs the stored procedure to "required" and any other step that needs to run under transaction to "supported." Keep in mind that SSIS transaction requires that a service is running (Distributed Transaction Coordinator) to use SSIS transactions. You also have to set your connection to "retainconnection."
2. You can just run the stored procedure under transaction by using "Begin Transaction" at the beginning and "Commit " at the end. Use a SQL "try-catch" so that if there is a problem, you can rollback the inserts when the "catch" is executed.

There are lots of online articles that discuss SSIS transactions and SQL transactions.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search