Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 How to import a series of file via SSIS

Author  Topic 

evmisu
Starting Member

17 Posts

Posted - 2009-01-20 : 04:20:41
Hi all,

I have a series of files, namely AD20080101, AD20080102, AD20080103, AD20080221, etc... in one folder(about 500files). I am now import it manually into a main table which is set to store all the information of that series of files.

Please tell me if there a straight way to import that series of files in one time through SSIS? Or any site for reference? Thank you for your kind help.

Andy Sam

revelator
Starting Member

32 Posts

Posted - 2009-01-20 : 05:31:34
Have a look at the Foreach Loop Container control flow item. You can use the Foreach File Enumerator to loop over all the files in a folder.



-----------------------------------
Waiting for the Great Leap Forwards
Go to Top of Page

rgombina
Constraint Violating Yak Guru

319 Posts

Posted - 2009-01-20 : 06:18:04
http://www.sqlis.com/post/Looping-over-files-with-the-Foreach-Loop.aspx
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-20 : 09:10:05
http://blogs.conchango.com/jamiethomson/archive/2005/05/30/SSIS_3A00_-Enumerating-files-in-a-Foreach-loop.aspx
Go to Top of Page

evmisu
Starting Member

17 Posts

Posted - 2009-01-21 : 01:39:03
Thx for information.

searching for how to set variable in Foreach container. so hard for me~~=P
Go to Top of Page

evmisu
Starting Member

17 Posts

Posted - 2009-01-21 : 02:28:44
For My source file is .dbf, I think the above-mentioned information may not functioned in my foreach setting. so tired for trying this over 3 hours.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-21 : 09:23:31
quote:
Originally posted by evmisu

Thx for information.

searching for how to set variable in Foreach container. so hard for me~~=P


doesnt article illustrate how to map variable value in for each loop?
Go to Top of Page

evmisu
Starting Member

17 Posts

Posted - 2009-01-21 : 21:33:42
Hi all

I try to use Foreach to loop all my .dbf file into my DB destination. This is my scenario:

1. set the variable mapping of Foreach task, namely user::filename
2. set the excat folder in Enumerator Configuration
3. place the expression on the connectionstring item of the connection manager as @[user::filename]
4. put my Data Flow Task inside the Foreach Task.
5. set the OLE DB Source data access mode to "table name or view name variable", Choose the "user::filename" variable
6. error message come up:
An OLE DC record is avaible. Source:" Microsoft OLE DB provider For Visual FoxPro: Hresult: ox80004005 Description:"Invalid path or file name."
Data Flow Task [OLE DB Source [1]]: opening a rowset for "Data Source=D:\DBFfile\;Provider=VFPOLEDB.2;"failed. Check that the object exists in the database.

Of Course My dbf exist in the folder D:\DBFfile, I don't know where is the problem.....

Go to Top of Page
   

- Advertisement -