Looping through files for importing
- From: "Conan Kelly" <CTBarbarin at msn dot com>
- Date: Thu, 6 Apr 2006 17:13:36 -0700
Hello all,
I have 60 text files that I need to import into a DB. I want to figure out a way to loop through the files automatically. Can this
be done in the DTS Package?
I understand how to loop through all files in a folder using VB/VBA, so I can manage that if I save the package as a VB File. The
only problem if I go that route is that there is a field missing in each data file (the Month End Date). But each file consists of
one month and conveniently has the month end date in the file name, so I can populate the field by extracting the date from the file
name.
How I normally would do this in a DTS Package is:
1. Select the file using the Open File Dialog Task I downloaded from www.SQLDTS.COM (store the path\filename in a global variable)
2. use an ActiveX Script Task to extract the date in the file name global variable and store it in a date global variable.
3. then in my Transform Data Task, I would have an ActiveX Script transformation assigning that date global variable to the MEDate
field.
This works okay, but it is one file at a time with some interaction from me selecting each file.
Now I can remove the Open File Dialog Task, save the package as a VB file, setup the VB code to loop through each file, and
extract/store the date from the file name in a date variable in VB.
The thing I don't understand is how to pass the date stored in that variable to the date global variable in the Package/Transform
Data Task code in VB. I don't understand the VB code that SQL Server comes up with very well.
Any help that anyone can provide will be greatly appreciated,
Conan Kelly
.
- Follow-Ups:
- Re: Looping through files for importing
- From: Allan Mitchell
- Re: Looping through files for importing
- From: ChrisR
- Re: Looping through files for importing
- Prev by Date: Export to XML with SSIS
- Next by Date: OMWWIZC share error?
- Previous by thread: Export to XML with SSIS
- Next by thread: Re: Looping through files for importing
- Index(es):
Relevant Pages
|
Loading