can I make package fail if precedence constraint fails

  • have 3 sequence containers. each evaluate two variables being equal to each other.

    Right now IF any of those pair aren't equal the package just stops running, which means there's no notification of failure.

    I want the package to stop and throw an error.

    way to do?

    --Quote me

  • polkadot (5/14/2015)


    have 3 sequence containers. each evaluate two variables being equal to each other.

    Right now IF any of those pair aren't equal the package just stops running, which means there's no notification of failure.

    I want the package to stop and throw an error.

    way to do?

    You cannot make a precedence constraint fail, it is not a task.

    If you are using condition "@a=@b"

    Then, what you can do is - Add one more precedence constraint to your tasks where you can put "@a!=@b" and then add a script task and add code to fail that task. Example -

    Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure

    ____________________________________________________________

    AP
  • Is that two Logical And precedence constraints per sequence container, one with @a==@b connecting to next sequence container and a second @a!=@b followed by a script task ???

    Also, not familiar with C#. I cut pasted given script into main section of template inside script task like this and it is giving error.

    public void Main()

    {

    // TODO: Add your code here

    Dts.TaskResult = (int)ScriptResults.Success;

    Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure;

    }

    }

    }

    Please advise.

    --Quote me

  • public void Main()

    {

    // TODO: Add your code here

    Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure;

    }

    ____________________________________________________________

    AP
  • with just that one line inside public void Main(), I get squiigly red line under the whole of Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure; and error.

    public void Main()

    {

    // TODO: Add your code here

    Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure;

    }

    ===================================

    Package Validation Error (Package Validation Error)

    ===================================

    Error at Script Task: The binary code for the script is not found. Please open the script in the designer by clicking Edit Script button and make sure it builds successfully.

    Error at Script Task: There were errors during task validation.

    (Microsoft.DataTransformationServices.VsIntegration)

    ------------------------------

    Program Location:

    at Microsoft.DataTransformationServices.Project.DataTransformationsPackageDebugger.ValidateAndRunDebugger(Int32 flags, DataWarehouseProjectManager manager, IOutputWindow outputWindow, DataTransformationsProjectConfigurationOptions options)

    at Microsoft.DataTransformationServices.Project.DtsPackagesFolderProjectFeature.ExecuteTaskOrPackage(ProjectItem prjItem, String taskPath)

    when I build as directed the error is

    "Only assignment, call, increment, decrement, and new object expressions can be used as a statement."

    Can you see reason why?

    --Quote me

  • I found this site http://stackoverflow.com/questions/25670293/ and modified as follows.

    public void Main()

    {

    // TODO: Add your code here

    Dts.TaskResult = (int)ScriptResults.Failure;

    return;

    }

    this builds and fails the ssis package if the != is true.

    Look right to you, Anshul?

    --Quote me

  • this builds and fails the ssis package if the != is true.

    Look right to you, Anshul?

    Looks fine to me.

    Cheers.

    ____________________________________________________________

    AP
  • thank you so much staying with me. Package is deployed!

    --Quote me

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply