dbTalk Databases Forums  

Delete Data Source file within DTS Package

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Delete Data Source file within DTS Package in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Carlos
 
Posts: n/a

Default 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/

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.