to make things easier on you guys, here are the mains steps I have in the DTS
I have the following global variables
ImportPath, which equals to âc:\data_fileâ and
ImportFile, which equals to âusers.txtâ
FileExists, which equals to False âthis is a flag I use either to move forward with the DTS or to stop itâ
(1)
First thing I check in my DTS is the existence of the file that Iâm loading by setting the flag âFileExistsâ to True or False
Function Main()
Dim objFSO, strDataFileName, ImportFullPath
Set objFSO = CreateObject("Scripting.FileSystemObject")
ImportPath = DTSGlobalVariables("ImportPath").Value
ImportFile = DTSGlobalVariables("ImportFile").Value
ImportFullPath = ImportPath & ImportFile
If objFSO.FileExists(ImportFullPath) Then
DTSGlobalVariables("FileExists").Value = True
Else
DTSGlobalVariables("FileExists").Value = False
End If
Set objFSO = Nothing
Main = DTSTaskExecResult_Success
End Function
(2)
Then I have an âExecute SQL Taskâ to clean up a holding table if it has data, in the workflow properties for this task, I have the following ActiveX code
Function Main()
If DTSGlobalVariables("FileExists").Value = True Then
Main = DTSStepScriptResult_ExecuteTask
Else
Main = DTSStepScriptResult_DontExecuteTask
End If
End Function
(3)
I load the file into a holding table
Then Iâm done.
Thanks
Database Analyst/Arch
|