Integration services : Implement onSuccess event in ssis. How to ? - ssis

I have a sequence container with multiple Execute package tasks in it. For each task what I want is to update a record in SQL table if the package executes successfully.
I looked into event handling but there is no OnSuccess event in SSIS. I have used OnError event handling for it and that seems to be working fine.
Is there a possibility to do that?

I would put the update in an execute package task right after the execute package task. If there is a failure the update will not happen.

Are you opposed to adding a component after your SQL query? This is using all scripts but the same principle can be applied if you wanted to use a Execute SQL Task or any other type of component. That way you can still run parallel, your table would be updated with ONLY the tasks that completed and your next item(s) in your control flow would still be valid

I see 2 possible ways of doing this
1: You can wrap each Execute package tasks inside its own container
and then
use precedence constraints with success and failure
2 You can inside each package handle your flow with update statements when it succeeds with constraints also.
But when your package task 1 fails, the main container will also fail and then your package will also fail, so consider setting maxmiumerrorcount to -1 or 999.
Then your MasterPackage will not fail, and your log will control for you which packages has failed.

Related

Azure Data Factory: How to trigger a pipeline after another pipeline completed successfully

In Azure Data Factory, how do I trigger a pipeline after other pipelines completed successfully?
In detail:
I seek to trigger an SSIS package after other pipelines completed successfully. I already know I can save my SSIS package as a pipeline and run it using a trigger like the other pipelines. But how do I make sure the SSIS package pipeline starts only after the other pipelines are finished? Is there a feature for this in Azure or do I need some kind of workaround for this?
Thanks in advance~
You could always create a parent pipeline that uses execute pipeline and execute SSIS package activities. ADF V2 has the concept of dependencies, so have a dependency between the execute pipeline activity and the execute SSIS package activity. Make sure to check the Wait on Completion box for the execute pipeline activity so that they run in sequence rather than in parallel. You can have multiple dependencies for an activity, so if you need SSIS to wait on 3 packages instead of just one, that should still work.
Then instead of triggering the other pipeline(s) and SSIS package separately, you can just trigger the parent pipeline instead.
Based on your descriptions,i think you could monitor azure data factory pipelines execution status programmatically.
Please add the following code to continuously check the status of the pipeline run until it finishes by it's RunId.
PipelineRun pipelineRun;
while (true)
{
pipelineRun = client.PipelineRuns.Get(resourceGroup, dataFactoryName, runResponse.RunId);
Console.WriteLine("Status: " + pipelineRun.Status);
if (pipelineRun.Status == "InProgress")
System.Threading.Thread.Sleep(15000);
else
break;
}
And starts your SSIS package if the pipeline runs successfully.
if (pipelineRun.Status == "Succeeded")
//..do your business
More details,please refer to this document.

SSIS 2016 system variable System::ErrorDescription missing?

Using SSIs 2016 trying to set an input parameter to a sql task to System::ErrorDescription, but that variable isnt listed. Is this variable not used any longer?
I have sql task that, if it fails, I want to log the error desciption to a table. Yes, I know I can enable logging, but I want also use this message in another task.
[Edit]
I think this variable is only visible within the context of an event handler such as OnError, correct?
The System::ErrorDescription variable is not available for all components, specifically it is only in the OnError, OnInformation, and OnWarning event handlers.
https://learn.microsoft.com/en-us/sql/integration-services/system-variables?view=sql-server-2016

Excel Source validation error not firing Data Flow task fail event

I have a package with a Data Flow task containing Excel Source. DelayValidation is set to True for the Data Flow.
There is an event handler OnTaskFailed at package level. However if the Excel Source validaton fails the OnTaskFailed handler does not execute. It seems the validation error does not fire Task Failed event.
Is it possible to configure it to fire the Task Failed event?
I think in your case, instead of setting up at the package level, you should set it at the data flow task level. What I mean is, in the event handler pane you can change the executable to the certain data flow task.

SSIS SQL Task Map Result Set to Project Parameter

I am implementing a custom auditing framework, logging ETL events such as start, end, error, insertrows etc.
As well as logging at a package level, I'm implementing "session logging" where a sequence of package executions, i.e. a controller package that executes several packages, is a session. In order to keep track of the "session", the stored procedures always return a SessionLogID.
I was hoping I could map this result set to a project parameter as otherwise, I will have to save it to a user var and then pass it around between packages via parameters. This will mean every single package will have a Package Parameter and User Variable called SessionLogID. I don't want to do this if I don't need to.
Open to other suggestions.
Thanks,
Adam
Parameters cannot change at runtime. They are a set once kind of deal whereas variables can change at any time. You can set the variable once in the parent package and map the variable to the child package's using a parameter.

Breakpoint in SSIS script task which is inside a ForEach Loop

I have an SSIS package which has got a foreach loop. inside the foreach loop I have a script task. I have put breakpoint in that script task, which gets hit but the problem is, it only gets hit on the first iteration. so if F10 or F5 it does not break again on the second iteration.
how can i make it break each time on the same point on each iteration.
It seems to be a expected behaviour of SSIS, as stated in Books Online:
"If a Script task is part of a Foreach Loop or For Loop container, the debugger ignores breakpoints in the Script task after the first iteration of the loop."
http://technet.microsoft.com/en-us/library/ms137625.aspx
You can try to work around it with the following alternatives:
Interrupt execution and display a modal message by using the MessageBox.Show method in the System.Windows.Forms namespace. (Remove this code after you complete the debugging process.)
Raise events for informational messages, warnings, and errors. The FireInformation, FireWarning, and FireError methods display the event description in the Visual Studio Output window. However, the FireProgress method, the Console.Write method, and Console.WriteLine method do not display any information in the Output window. Messages from the FireProgress event appear on the Progress tab of SSIS Designer. For more information, see Raising Events in the Script Component.
Log events or user-defined messages to enabled logging providers. For more information, see Logging in the Script Component.
http://technet.microsoft.com/en-us/library/ms136033.aspx
I know this is old question, but I have an idea like to share
As it's been answered by Guilherme, I can add something might be useful, if your foreach is based on a SQL query, you can add a ROW_NNUMBER() to it and assign it to a variable, inside the script task you can compare the value of this variable and break the task on any row you want.
if (Dts.Variables["Your_Variable"].Value.ToString() == "4") {
Console.WriteLine("Break");
}
At least you can stop iterating any place in the loop, rather than the first iteration.