Search code examples
sql-serverssisssis-2008msbiscript-task

SSIS Variable- Evaluating Expression Taking Time in Script Task


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


Solution

  • 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.