Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Data Warehousing
»
Integration Services
»
Importing files in multiple folders at the...
Importing files in multiple folders at the same time using ssis
Rate Topic
Display Mode
Topic Options
Author
Message
dbman
dbman
Posted Wednesday, December 12, 2012 5:36 AM
Valued Member
Group: General Forum Members
Last Login: Thursday, May 16, 2013 8:42 AM
Points: 71,
Visits: 1,067
I have 10 folders each receiving a .csv file on a daily basis. I would like to create a package to import these files into a database on a daily basis.
Data/Ab1/mon.csv
Data/Ab2/mon.csv
Data/Ab2/mon.csv
I know i could probably create single packages for each file import in each folder but i would like to know if i can create a single package to to run all the imports at the same time.
Can anyone explain the steps to do this?
I understand i can use a Foreach Loop Container..but I am a little unsure how.
Regards
Post #1395607
aaron.reese
aaron.reese
Posted Wednesday, December 12, 2012 5:57 AM
SSC Veteran
Group: General Forum Members
Last Login: Monday, May 13, 2013 7:33 AM
Points: 234,
Visits: 441
The short answer is yes
Are the files going into the same table, if so is there any need to identify which file or folder they came from. If not then you can just use Bulk Insert Task.
If the data is going to different tables or needs the file identifier on it then you will need to use a Data flow Task and the data transormation options to insert, convert and lookup column values
Are the folder names dynamic, If not then the BFI (Brute Force and Ignorance) method would be best: Create 10 FlatFileConnections
If they are dynamic then you can change the connection string of the FlatFileConnection string using an expression, but the formats of the source files must be the same.
Post #1395618
dbman
dbman
Posted Wednesday, December 12, 2012 7:19 AM
Valued Member
Group: General Forum Members
Last Login: Thursday, May 16, 2013 8:42 AM
Points: 71,
Visits: 1,067
Yes the files are going into the same table. There is no need to identify which folder they came from. Ive looked at the Bulk Insert Task, but am a little unsure how to Bulk insert multiple files in these multiple folders.
Post #1395660
anthony.green
anthony.green
Posted Wednesday, December 12, 2012 7:52 AM
SSCertifiable
Group: General Forum Members
Last Login: Friday, April 12, 2013 3:51 AM
Points: 5,075,
Visits: 4,831
Use a for each loop with the transverse subfolders option set and then you can change the connectionstring of the csv connection manager dynamically.
Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1
&
Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger
Post #1395680
aaron.reese
aaron.reese
Posted Thursday, December 13, 2012 8:26 AM
SSC Veteran
Group: General Forum Members
Last Login: Monday, May 13, 2013 7:33 AM
Points: 234,
Visits: 441
@Anthony.
Do you mean change the FlatFileConnection on each loop (i.e. 10 FFCs and choose each one dynamically) or do you mean one FFC and change it's source in each loop.
To be honest, if it is really only 10 folders and the folders are static, I would just set up 10 bulk insert tasks with 10 FFCs and be done with it
Post #1396223
anthony.green
anthony.green
Posted Thursday, December 13, 2012 8:30 AM
SSCertifiable
Group: General Forum Members
Last Login: Friday, April 12, 2013 3:51 AM
Points: 5,075,
Visits: 4,831
1 ForEach loop with 1 flat file connection, grabs the files from a sub folder, changes the connection string of the ffc at loop time.
The issue now comes down with are the files and folder names static or can they change and what happens to the file after it has been imported, which will determine which way to write the package
Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1
&
Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger
Post #1396228
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.