Sunday, February 19, 2012

How to choose one of two success-paths?

I have an ActiveX Script Task in SQL Server 2000. It chooses one of two
possible success-paths depending on if a file exist or not. (Part of the old ActiveX Script for choosing next step is below)

I need to rewrite this for a Script Task in SQL Server 2005 but it seems like it
doesn't have this functionality and objects.

Does anyone know how to write the code for choosing the next step in a
Script Task or knows another way to solve my problem?

The package is not suppose to fail if the file is missing, it's must succeed and that's why I need two success-paths.

Regards,
Sara

'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main ()

Dim pkg
Dim stpContinuePkg
Dim stpExit

SET pkg = DTSGlobalVariables.Parent

SET stpContinuePkg = pkg.Steps("DTSStep_DTSActiveScriptTask_4")
SET stpExit = pkg.Steps("DTSStep_DTSActiveScriptTask_21")

If ...... Then
Main = DTSStepScriptResult_ExecuteTask
stpContinuePkg.DisableStep = False
stpExit.DisableStep = True
Else
.......
End If

Main = DTSTaskExecResult_Success

End Function

What you are talking about is conditional execution. You're right that you have to write script to do this in DTS but it is much easier in SSIS because you can put conditions on the precedence constraints.

All explained here: http://www.sqlis.com/default.aspx?306

-Jamie

|||

Thanks a lot for your answer!

Regards,
Sara

No comments:

Post a Comment