all groups > sql server dts > february 2005 >
You're in the

sql server dts

group:

Dts import



Dts import chinna jambu via SQLMonster.com
2/11/2005 8:54:15 PM
sql server dts: 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 All 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
if left (sFilename,20) = "//cpmqsit\mssql7\ldp" then
Exit For
end if

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


because of this statement For Each fsoFile in fsoFolder.Files , all files
are loaded in to the table.

please reply me as soon as possible Urgent.

thanks

--
Re: Dts import chinna jambu via SQLMonster.com
2/12/2005 12:22:35 AM
the files are ftp in to the directory. i can't move or rename them. i
have to load files only from the same directory in to the table .

urgent please

--
AddThis Social Bookmark Button