Wednesday, October 3, 2012

DTS file not found error

Unlike SSIS , DTS doesn't have any "for each loop " task to loop the files from a folder.

If you have any Jscript task which is looking for a file and failing when there is no file

on the source folder then below steps will help to stop the execution of a dts package

when there is no file exists.

Steps :

1. click on the workflow properties of the task which has to be stop when a file doesn't exist

image

2. select the checkbox [Use ActiveX script] and click on properties

image

3.make sure it's a visual basic script language

image

4. add the below code in the code window above

'**********************************************************************
'  Visual Basic ActiveX Script
'************************************************************************


Function Main()
    dim  objFSO

    Set objFSO = CreateObject("Scripting.FileSystemObject")

        If objFSO.FileExists(DTSGlobalVariables("varFileName").value) Then
       
   
    Main = DTSStepScriptResult_ExecuteTask

    else
    
    Main = DTSStepScriptResult_DontExecuteTask

    end if

End Function

No comments:

Post a Comment

Featured Post

SQL Server AWS Migration BCP

stored procedure to generate BCP scritps to migrate the SQL Server database. Developed this stored procedure on my labs to simulate t...

Contributors