dbTalk Databases Forums  

Dts import

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


Discuss Dts import in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
chinna jambu via SQLMonster.com
 
Posts: n/a

Default Dts import - 02-11-2005 , 02:54 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 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

--
Message posted via http://www.sqlmonster.com

Reply With Quote
  #2  
Old   
chinna jambu via SQLMonster.com
 
Posts: n/a

Default Re: Dts import - 02-11-2005 , 06:22 PM






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

--
Message posted via http://www.sqlmonster.com

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.