Delete Data Source file within DTS Package -
03-23-2009
, 03:17 PM
I have a requirement to import the data from an excel spreadsheet onto a sql table. I'd like to be able to delete the source after successfully importing the data to be ready for the next batch of data.
I wrote an actieX Script that deletes the file fine, but once I attach it to the Import Step - it fails. The delete step fails all the time.
Here is my active X script:
' Delete File
Function Main()
Dim FSO, sFileName
' Get the name of the file from the global variable "ImportFileName"
sFilename = DTSGlobalVariables.Parent.Connections("Connection 1").DataSource
Set FSO = CreateObject("Scripting.FileSystemObject")
' Check for file and return appropriate result
If FSO.FileExists(sFilename) Then
FSO.DeleteFile sFileName
Main = DTSTaskExecResult_Success
End If
Set FSO = Nothing
End Function
From http://www.developmentnow.com/g/103_...server-dts.htm
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com/g/ |