I have a package that iterates several times, one for each Category. I put a transaction in the package such that each Category completes in full or not at all. If I have 3 Categories, A B and C, and Category B fails, I want to ensure that A and C will run successfully. However, currently, when B fails, the package execution halts with an error instead of moving on to the next Category.
I have a ForEach Loop container that iterates over the Categories. Inside that, I have a sequence container with the Transaction option set to Required. This should make each iteration its own transaction.
How do I get that package to move onto the next Category when another Category fails and rolls back?
Thanks in advance for any help.
Change the maximum error count of the Loop container and all parent containers to 3, and changed the "stop package on failure" flag to false. This should allow it to continue looping.
While this should work, I don't advocate this approach. I would split the three transactions into separate containers, connected by "Completion" constraints, since there may be errors that should still halt package execution.
Related
I have two SSIS projects within the same folder - let's call them Parent.dtsx and Child.dtsx.
Child solution has many SQL task split by different Sequence Containers.
What I need to do is to (in Parent) execute SQL task from (Child). I don't want to execute whole Child solution, only part of it.
I has been searching for a proper solution for a while, but I haven't found a proper answer yet.
Every Parent-Child solution I've seen presents how to execute whole solution (Child) within Parent one.
I tried to execute selected tasks from Child solution by passing the SQL task ID to the Execute Package Task but if failed. Probably, I don't want to pass any variables from Child to Parent - I just need to execute selected SQL tasks from Child.
I'm a beginner when it comes to SSIS.
Thanks,
Karol
Every Parent-Child solution I've seen presents how to execute whole
solution (Child) within Parent one.
That's because that's the only way it works. There is no way to call only some elements of a child package from a parent package; you can only execute the entire child package, unless you want to get into some extremely complicated low-level coding in a script task.
You need to decide where your tipping point is, and do one of the following (whichever is more desirable in your case):
Copy the SQL Task from your Child package and paste it into your parent package, and just have everything in one package.
Modify your child package so that you can pass it a variable, and only execute certain tasks based on the variable that is passed.
Make your solution even more modular: Take the Task you want to execute out of the child package, and put it in its own package all by itself. Then you can call that third package from the child package, and/or you call it directly from the parent package.
Those are your best options.
EDIT: An idea of how to do option 2 - Add a variable to the child package. In the precedence constraints before each task, check the variable, and if it isn't a certain value, then skip that step.
In other words, from your first step, (which may have to be a "dummy" script, because it is going to get executed every time the package starts no matter what), you have multiple constraints coming out. One that says if the first step is complete and the variable equals some value, go to step 2. Another that says if the first step is complete and the variable equals some other value, go to step 3, and so on and so on.
And then from your parent package, you pass whatever variable value will tell the child package to only execute the task you want to execute.
It ends up looking pretty ugly, because you have precedence constraints all over the place, but we have used it in the past and it works. It won't be too bad if you only have two possible paths you want the execution to take.
I have a package where I want to have task A always run and B or C run (but not both) and I want them to run concurrently before they (all three) go to the next task. So I know how to set the constraints so that either B or C succeeds but adding in A is a problem. In the Multiple Constraints part of the editor I need another option to point to the task (A) that is AND while the other two tasks are OR.
Anybody know a way to work around that?
I have an int variable User::FileLineCount scoped in a for loop container and in a task within the loop, I want to proceed from the task depending in this variable's value.
In the Precedence Constraint Editor I have chosen Evaluation Operation as Expression and the Expression as #FileLineCount!=0. There is another version to some other task as #FileLineCount==0. When I debug, I can see that the User::FileLineCount value is 0 but when I step Over the task I get Unable to step. Not Implemented. error.
Thanks for the help
EDIT: Apparently the debugger could not step over so that was the reason for the error but the conditions still do not work properly.
EDIT2:
The other one is #FileLineCount==0. Doesnt work without OR'in as in the picture.
I had two paths leaving a data flow task one would go to a sql task and the other would go to another task. I was struggling with this until I realized that two paths leaving the same data flow task would be an or if they were different paths. I assume that you would use AND if you had multiple tasks going into one task and you needed them all to be true for it to proceed. I'm not sure if this exactly what you are asking.
This would be or, because I want one or the other.
Where below I want all three to be true to continue to send the email.
how to fetch records based on a condition
eg: I have 100 records in my table. Each time I would like to fetch 10 records at a time and then next set of 10 records until the table data ends.
First, Not sure why you would want to do that. You could specify the batch size in your destination.
But if you had any other significant reason do process 10 records at a time, then you use a foreach loop. There is no FOR..LOOP inside a data flow task.
option #1. Get the record count in the control flow, then create a for loop container and assign the variables. Inside the container, use a dataflow task and filter the source using the variables and process them.
NM
I'm trying to debug some legacy Integration Services code, and really want some confirmation on what I think the problem is:
We have a very large data task inside a control flow container. This control flow container is set up with TransactionOption = supported - i.e. it will 'inherit' transactions from parent containers, but none are set up here.
Inside the data flow there is a call to a stored proc that writes to a table with pseudo code something like:
"If a record doesn't exist that matches these parameters then write it"
Now, the issue is that there are three records being passed into this proc all with the same parameters, so logically the first record doesn't find a match and a record is created. The second record (with the same parameters) also doesn't find a match and another record is created.
My understanding is that the first 'record' passed to the proc in the dataflow is uncommitted and therefore can't be 'read' by the second call. The upshot being that all three records create a row, when logically only the first should.
In this scenario am I right in thinking that it is the uncommitted transaction that stops the second call from seeing the first? Even setting the isolation level on the container doesn't help because it's not being wrapped in a transaction anyway....
Hope that makes sense, and any advice gratefully received. Work-arounds confer god-like status on you.
Is the flow too large to stream all these rows through an aggregate first, to eliminate the duplicates?
If the changes are inside the same transaction they should be visible to each other. And I don't think that SSIS would create a transaction per statement / SP call, so my opinion is that the problem is elsewhere.