SSIS Precedence Constraint Expression not working - ssis

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.

Related

How to from one SSIS project execute sql task that is located in another SSIS project

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.

SSIS: how to use single variable in two tasks

I have an SSIS package with a Data Flow Task and an FTP Task. I have to use two expression variables like this:
(These create dynamic file names using date parts)
Otherwise if I have just one variable, one task steps on the variable while the other task is trying to use it and gives me the 'cannot lock variable for readonly' error.
Is it possible to have one variable work in two places? Would seem intuitive... This is sloppy. Should someone change one variable without the other to match it would bomb.
I added an Expression Task before the Data Flow... bingo
If you do not require those two tasks to run in parallel, then force one task to complete before the other begins (precedence constraints etc.) - that should prevent race conditions on the single variable.

Dynamic SSIS transforms building tables lists at run time

I'm looking for some pointers in creating an SSIS based workflow that reads a list of tables at run time from a database and then uses each of these as ADO inputs, selects specific columns from each table and then adds these to a staging area. I've had a quick play with the union task but was looking for some pointers in terms of direction to take ?
I can't seem to find anything on the net that does what I need and am not sure if SSIS can bend to suit my needs.
Many thanks in advance.
You can do this but the only method I can think of is a little convoluted.
You would need to use a "for each loop container" to loop through your list of tables & read each table name into an SSIS variable.
Within the "foreach":
add a script task to build your actual query into another SSIS variable.
add a data flow
within the Data Flow use a source of "SQL Command from variable".
do data flow "stuff"
I hope this makes some kind of sense? :-)

Controlling the flow in SSIS package based on a condition

Is there a way to conditionally (through a script task or anything else), control the flow of program in SSIS?
Currently I have a package that would create 5 different excel sheets (through Execute SQL Task) dynamically. There maybe times when all 5 will have data or only 1 may have data. When its just 1 that has data, it is fine. But the real problem arises when there are 5 DFT's that are trying to write the data simultaneously to the same workbook (albeit different sheets inside that). The package fails with an OLEDB error.
After a lot of head breaking, I finally figured out that it was a concurrency control issue that wasn't allowing me to write to the excel file simultaneously. To further my solution, I used expressions on precedence constraints to control if the sheets get created or not.
But the real trouble is that after creating the sheets, the package would fail trying to write data to 2 different sheets simultaneously.
Is there a way, I can assign an 'Execution Order' for the DFT's? This is the reason I am looking for a script task so that when a particular sheet's count is 0 then it does no work and the control moves to another branch.
I hope I have not confused you here. But if I have, I'll be glad to provide more details on this question. Thanks for reading.
My first thought is to have a bunch of sequence containers, one per possible Excel sheet, each of which holds three tasks:
A script task to figure out whether or not to create the sheet, and set a boolean package variable accordingly
An SQL task to create the worksheet
A data flow task to populate the worksheet
The precedence constraint between tasks 1 and 2 would be an expression of the boolean being true:
The precedence constraint between tasks 2 and 3 would be a success constraint, as would the precedence constraints between the sequence containers. Overall, it would look like this:

Uncommitted reads in SSIS

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.