Reputation: 82341
I need a way to execute a stored procedure whenever my ssis package ends.
Regardless if it’s a failure or success.
Is there any way to do this without connecting failure events from each of my tasks? I’ve been looking for an OnPackageEnd event or something but I can’t see it.
Do any of you have any ideas?
Upvotes: 2
Views: 3295
Reputation: 96572
Well I think the simplest thing is to add the execution of the proc as a second step in the job that executes the package, you can specify there that you can go to the next step on failure as well as on success.
Or you put the Exec SQL task to execute the package at the end of the process (that gets the success branch) and put it in the event handler for all failures (we do the event handler at the package level not for individual steps), we do that for one step where we run the same proc but with different input values in case of failure or success.
Upvotes: 3
Reputation: 1
OnPostExecute gets executed for every tasks. So this is not good for a requirement that expects OnPackageEnd kind of an event.
Upvotes: 0
Reputation: 36146
You can create an event handler onPostExecute of the pacakge and add the proc on an execute SQL Task in there
OR
add all your current components inside a sequence container and drag the green arrow to a new execute sql task component with your procedure. Double click the green arrow and select "Completion" instead of "Success"
Upvotes: 1
Reputation: 51
In the package put all the tasks in a container. And below the container put the execute proceduer task and for precedence constraint choose values as "Completion"(The line will be in Blue color, green by default). So irrespective of the package status (success or fail) the stored proc will be executed.
Upvotes: 5