SSIS tasks execution order problem
Hi, I'm facing a problem with my SSIS package regarding the execution order of tasks. I am using my package for the purpose of loading data from XML to staging tables in the database, and have a loop to process all XML files. As a precondition to the loading action itself, I am running a stored procedure against the database (using the ExecuteSQL task) to check whether all staging tables are empty. The output parameter of that stored procedure is mapped to a variable I have defined in the SSIS package, so I can use it as a basis for the decision whether to run the loading action or not. In order to test my package I added a script task, right after the execution of the stored procedure with a precedence constraint, that pops up a messagebox with the value of the stored procedure return value stored in the package variable. The problem is that for the first iteration of the loop, the variable value presented by the messagebox is incorrect (equals to the initial value I assigned to the variable), and it looks like the script task starts before the stored procedure execution task finishes and its output value is stored in the package variable. Please assist.
June 9th, 2006 12:24pm

Strange. You're sure the Precedence Constraint is between the SQL Task and the Script Task? How are you accessing the variable in the script task? Are you sure it's the right variable? Are there more than one variables with the same name? Can you set a breakpoint on the script task OnPreExecute and then look at the variable that's supposed to change in the watch? Does it have the right value? K
Free Windows Admin Tool Kit Click here and download it now
June 9th, 2006 12:59pm

Set "Evaluate as expression" to false on the variable. You're using an expression to set the initial value of the variable right? I had this problem this morning... the for loop component seems to acess the variable in some way which causes the expression to be evaluated every time.. (its not like an initial value that just gets set at runtime) so your loop counter doesn't get incremented... You'll need to use some other way to initialise the variable... HTH PJ
June 9th, 2006 4:45pm

First of all, thanks for the advise. After I almost gave up, I just closed the solution, closed Visual Studio, and when I opened the solution again and ran it (changed nothing from previous runs), everything worked as expected (believe it or not).
Free Windows Admin Tool Kit Click here and download it now
June 13th, 2006 5:05pm

Oh, you hadn't done THAT ? Ahh yeah.. SSIS is very flakey in my experience.. I do a lot of closing it down and even rebooting the machine.. I find it fixes problems regularly... PJ
June 13th, 2006 5:10pm

Sounds like real solutions to a great tool :). Having same issue, may be SSIS should have a guideline that whenever you face any issues try restarting and then rebooting. Thank you
Free Windows Admin Tool Kit Click here and download it now
November 10th, 2010 2:12pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics