DTS Csv Files Import into SQL Server -
02-09-2005
, 08:50 PM
I have 10 csv files with different names in c:\mydirectory\.
I created global variable "ImportFolder" which has value "c:\mydirectory\
LDP_*.csv"
files names are
LDP_aaa.csv,
Ldp_bbb.csv,
LDP_ccc.csv
ADP_aaa.csv,
ADp_bbb.csv,
ADp_cc.csv. ....
My question here is i want to import only LDP_*.csv to sql server table
and ignore ADP_*.csv files from the directory in sequence.
Here is the code i used to get first file from directory.
Function Main()
Dim sFolder
Dim fso
Dim fsoFolder
Dim fsoFile
Dim sFilename
sFolder = DTSGlobalVariables("ImportFolder")
set fso = CreateObject("Scripting.FileSystemObject")
set fsoFolder = fso.GetFolder(sFolder)
For Each fsoFile in fsoFolder.Files
sFilename = sFolder & fsoFile.Name
Exit For
Next
Dim oPKG
Dim oConnection
Dim stdEnterLoop
set oPKG = DTSGlobalVariables.Parent
set oConnection = oPKG.Connections ("Text File (Source)")
oConnection.DataSource = sFilename
Main = DTSTaskExecResult_Success
End Function
please reply me as soon as possible with code.
thanks
--
Message posted via http://www.sqlmonster.com |