2

I have a Variable which uses another variable to get its value. I had set the EvaluateAsExpression property to True. Now when I use this variable in a Script task it is taking 2-3 Minutes to evaluate that expression. But if I Hard Code the variable value instead of reading it from another variable then it is finishing in less than a Second. Anyone let me know if I am missing anything ? I am using BIDS/SSIS 2008

Variable1: D:\app\srikar.mogaliraju
Variable2: @[User::Variable1]+"\\Product"

Script Task Code:

        public void Main()
        {

            String SourceFolderPath, DestinationFolderpath;
            SourceFolderPath = Dts.Variables["User::Variable2"].Value.ToString();

//Random Code
 Dts.TaskResult = (int)ScriptResults.Success;
        }

Variable 2 Expression Builder: enter image description here

  • What is the expression it? But I would say the machine it is running on is under-powered. – Arthur May 28 '19 at 17:54
  • @Arthur Added the expression in my question. – Srikar mogaliraju May 28 '19 at 18:00
  • @Arthur When I use this Evaluated Variable in other tasks except Script task, it is working with out any problem. I am facing the problem only with script task. – Srikar mogaliraju May 28 '19 at 18:02
  • That's a slowness on the parser end. Looks like it takes longer for it to get inside the Script Task than any other – Arthur May 28 '19 at 18:22
  • @Arthur Any suggestions to perform a Trail and Error to make it faster? – Srikar mogaliraju May 28 '19 at 18:28
  • 1
    Set it up outside the *Script Task* @Srikar – Arthur May 28 '19 at 18:30
  • 1
    @Srikarmogaliraju Why are you using a script task to set another package variable's value. You can do this in the Package Variables Expressions property. This is both easier and simpler. – J Weezy May 28 '19 at 19:41
  • @JWeezy I am not setting it in the Script task. I am just using the Variable whose value is set in the Package Variables Expressions property. – Srikar mogaliraju May 29 '19 at 12:27
  • 1
    @Srikarmogaliraju It might be more helpful if you post the script task code so we can look at it and try to diagnose the problem. – J Weezy May 29 '19 at 14:01
  • @JWeezy Edited my question to add Script Task code and Variable 2 Expression Builder. The problem is at the reading of variable value in Script task. – Srikar mogaliraju May 29 '19 at 15:22
  • Are you sure that the delay is on the line where the expression is being calculated and not elsewhere? Simple string concatenation shouldn't yield problems. Maybe it's the rest of the code in the script. Do you have parallel executions? – EzLo May 29 '19 at 15:26
  • @Srikarmogaliraju Are you trying to perform an expression evaluation in the script task? If yes, that is wrong. You perform variable Expression Evaluation in the Variables window. You then select those variables in the Script Task UI for either ReadOnly or ReadWrite. – J Weezy May 29 '19 at 15:31
  • @EzLo I am sure it is because of the expression being calculated. I kept a break point their to confirm the same. if i remove the expression builder and hard code the value of the variable, there is not issue at all. – Srikar mogaliraju May 30 '19 at 05:10
  • @JWeezy I am performing the expression evaluation in Variables windown. Edited my question with a screenshot for the same. – Srikar mogaliraju May 30 '19 at 06:05

1 Answers1

0

I haven't got any solution for this. So posting the answer with the solution I implemented to bypass this problem.

  1. Use ExecuteSqlTask to read Variable1 and Append "\Product" to Variable1 value.Set the result set property to Single Row.
  2. Assign the Result Set to Variable2 and use this Variable in Script task.