0

When running an SSIS package on SQL Server 2014 (v12.0.5556), it appears to be skipping Script Tasks. The test package does the following:

  • Defines a variable X and initializes it to 0
  • Uses a Script Task to set the value of X to 1
  • Branches based on the value of X

Since the Script Task sets X=1, it should always branch to the task named Value is 1. It works when running within VS 2015.

When deployed to SQL Server (local machine or server), it branches to Value is 0 as if the Script Task never ran. However, the SSIS Logs show that the task was run successfully.

Are there any settings in SQL server or in the package that would cause it to skip Script Tasks when deployed to SQL Server?

Here's the package: The Test Package

The User::X variable is set as a ReadWriteVariable. Here's the code in the Script Task:

    public void Main()
    {
        Dts.Variables["User::X"].Value = 1;
        Dts.TaskResult = (int)ScriptResults.Success;
    }

Here's the result when run in Visual Studio (it branches to Value is 1): enter image description here

Here's the result when run in SQL Server (it branches to Value is 0): enter image description here

Doug Clutter
  • 3,646
  • 2
  • 29
  • 31
  • the fact that the green arrows have a little "Fx", means that there's a constraint in there. If you double click them, you'll be able to see what's the constraint – Lamak Oct 10 '17 at 20:42
  • @Lamak that was intentional. The conditions check the value of X and branches to the appropriate Task. I did this to show that the value of X is set when run in VS but is not set when run in SS. – Doug Clutter Oct 10 '17 at 20:47
  • try to write this instead Dts.Variables["User::MyIntegerVariable"].Value = Convert.ToInt32(Dts.Variables["User::MyIntegerVariable"].Value) + 1; – SqlKindaGuy Oct 11 '17 at 07:48

1 Answers1

0

Changing the 'Deployment target Version' will correct this issue. Makes sure this value matches the installed version of SQLServer. This is a similar issue: SSIS: script task (vs15) not work when deploy on sql server 2014

enter image description here

From the Project Properties Dialog Box: enter image description here

Jason Byrd
  • 566
  • 3
  • 7