sknox (3/31/2009)
There's also a tweak I would make to eliminate a (very small) chance of failure if the file is put out there literally at the last second. Change
...
If Now() >= NewDT Then
Dts.TaskResult = ScriptResults.Failure
Else
Dts.TaskResult = ScriptResults.Success
End If
...
to
...
If System.IO.File.Exists(Dts.Variables("FlatFileConnection").Value.ToString) Then
Dts.TaskResult = ScriptResults.Success
Else
Dts.TaskResult = ScriptResults.Failure
End If
...
This way, the success is dependant on the real thing you want to check (i.e, the existence of the file). Otherwise, if the file arrives at the last second or some other performance issue causes the task to run slowly, you may get a failure even with the file out there.
The only thing is that I dont want it to keep checking past a certain amount of time, so in your case wouldnt the job keep going until the file is found?