locked
question about precedence constraints RRS feed

  • Question

  • Hi, 


    I have the following design,  but  if sequence container is successful, then it goes to Script Task 1.
    but somehow even if "Script Task 1" was successful,  it won't go to the next step "script task 2". 
    If I removed "Failure" constraint to script task 2, then the problem went away.

    Is it because you cannot have both failure constraint and success constraint to "script task 2"?




    <sequence container>
           |                   |
           |failure          |success
           |                   |
           |                   |
           |                   |
           |                   |
           |                   V
           |           <Script task 1>         
           |                   |
           |                   |
           |                   |success
           |                   |
           |                   |
           |                   |
           V                  V
      <**** script  task 2****>


    Thanks
    Thursday, May 7, 2009 2:20 PM

Answers

  • You need to put an OR precedence for the constraints arriving to "script task 2".

    • Proposed as answer by Todd McDermid Thursday, May 7, 2009 2:42 PM
    • Marked as answer by sqlmania Thursday, May 7, 2009 3:41 PM
    Thursday, May 7, 2009 2:39 PM
  • Thanks Radu.


    one other question,

    How do I fake <sequence container> the first step to fail so I can test the "failure" part?
    is there a setting which I can turn on or off?

    I actually tried to set the property "ForceExecutionResult=Failure"
    but when I run the package, it didn't fail.  I'm not sure why it ignores the setting.




    So no one knows?

    You gave us 19 minutes in which to answer. Give us a chance :)

    I would have expected ForceExecutionResult=Failure to work but never mind. Another option is to drop a script task into the sequence container. Find the following line:
    Dts.TaskResult = (int)ScriptResults.Success;
    and change it to
    Dts.TaskResult = (int)ScriptResults.Failure;

    [N.B. This syntax is C#, it'll be different if you're using VB.Net but still should be fairly obvious]
    http://jamiethomson.spaces.live.com/ | http://blogs.conchango.com/jamiethomson | @jamiet
    • Marked as answer by sqlmania Thursday, May 7, 2009 3:32 PM
    Thursday, May 7, 2009 3:14 PM

All replies

  • You need to put an OR precedence for the constraints arriving to "script task 2".

    • Proposed as answer by Todd McDermid Thursday, May 7, 2009 2:42 PM
    • Marked as answer by sqlmania Thursday, May 7, 2009 3:41 PM
    Thursday, May 7, 2009 2:39 PM
  • Thanks Radu.


    one other question,

    How do I fake <sequence container> the first step to fail so I can test the "failure" part?
    is there a setting which I can turn on or off?

    I actually tried to set the property "ForceExecutionResult=Failure"
    but when I run the package, it didn't fail.  I'm not sure why it ignores the setting.


    Thursday, May 7, 2009 2:44 PM
  • Thanks Radu.


    one other question,

    How do I fake <sequence container> the first step to fail so I can test the "failure" part?
    is there a setting which I can turn on or off?

    I actually tried to set the property "ForceExecutionResult=Failure"
    but when I run the package, it didn't fail.  I'm not sure why it ignores the setting.




    So no one knows?
    Thursday, May 7, 2009 3:04 PM
  • Choose a task in the container and fail it changing ForceExecutionResult to Failure and FailParentOnFailure to True.

    Thursday, May 7, 2009 3:13 PM
  • Thanks Radu.


    one other question,

    How do I fake <sequence container> the first step to fail so I can test the "failure" part?
    is there a setting which I can turn on or off?

    I actually tried to set the property "ForceExecutionResult=Failure"
    but when I run the package, it didn't fail.  I'm not sure why it ignores the setting.




    So no one knows?

    You gave us 19 minutes in which to answer. Give us a chance :)

    I would have expected ForceExecutionResult=Failure to work but never mind. Another option is to drop a script task into the sequence container. Find the following line:
    Dts.TaskResult = (int)ScriptResults.Success;
    and change it to
    Dts.TaskResult = (int)ScriptResults.Failure;

    [N.B. This syntax is C#, it'll be different if you're using VB.Net but still should be fairly obvious]
    http://jamiethomson.spaces.live.com/ | http://blogs.conchango.com/jamiethomson | @jamiet
    • Marked as answer by sqlmania Thursday, May 7, 2009 3:32 PM
    Thursday, May 7, 2009 3:14 PM