SSIS Script task Help

  • I have a simple script task below that checks if a file exists or not.

    If success it runs a container.

    If fails the script fails.

    The problem is that I want to continue to the next script task although It appears that the whole package fails.

    How do I continue the flow to the next script task?

    filename = Dts.Connections(strMyConn).ConnectionString

    '' Check if the named file exists

    If System.IO.File.Exists(filename) Then

    Dts.TaskResult = Dts.Results.Success

    Else

    Dts.TaskResult = Dts.Results.Failure

    End If

  • I think you need to try a different approach.

    Instead setting the task result to success or failure, try setting a global variable to success or failure.

    You can then use the value of that variable to control how to flow to the next step.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • You could put the script in an appropriate event handler (but watch for excessive\unnecessary firing). If u put it in the event handler, the event handler will let the script pass through even though an error occurs. (Dont know if this is a MS bug or they intended to make the event handlers work that way).

  • Declare a variable user::blnVariable, set the variable as ReadWrite in the script properties, and depending on whether the file is found in the scripting task, feed the value back to the variable in the script Dts.Variables("blnVariable ").Value = False followed by setting the precedence constraint as Expression and Constraint with the constraint as @[User::blnVariable] !=True to determine the correct data flow path. Your step would now know where the dark side is.

    Max

Viewing 4 posts - 1 through 3 (of 3 total)

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