Phase 2
So now we have the Global Variable FileNameUsedForLoading loaded with the name of our file and the location in which it will be after we move it in phase 3, we can, using parameters in the ExecuteSQL task, insert that filename into our database table SourceFileLocations
Phase 3
This is a very simple phase. We set the phase 1 step back to waiting so we can loop back around and we also move the file we found earlier into the loading directory
Function Main()
Dim fso
set fso = CREATEOBJECT("Scripting.FileSystemObject")
'The trick to looping in DTS is to set the step at the start
'of the loop to an execution status of waiting
DTSGlobalVariables.Parent.Steps("DTSStep_DTSActiveScriptTask_1").ExecutionStatus = DTSStepExecStat_Waiting
fso.MoveFile DTSGlobalVariables("NameOfFile").Value ,DTSGlobalVariables("Archivedirectory").Value
Main = DTSTaskExecResult_Success
End Function