question

apple avatar image
apple asked

Loading csv file stored in different folders

hi! We receive data feed from the client every day so the folders are created with datenames like 20160101,20160102 etc. There are five different csv files in each folder and the naming convention is same as the folder like test_20160101.csv,test2_20160101.csv. In this I need to pick only test2 csv files in different folders and load into a sql table. Appreciate any suggestions Thank you
ssis
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
JohnM avatar image
JohnM answered
You should be able do this with SSIS. Are the file names consistent? Always test2 (whatever)?Use a ForEach loop to build a collection for the files that you want. The loop will iterate through children folders if you specify it to do so. This is an older article but still valid: https://www.simple-talk.com/sql/ssis/ssis-basics-introducing-the-foreach-loop-container/ Hope that helps!
2 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks a lot John, I got confused because of the different folders.
0 Likes 0 ·
Just set the collection for the parent folder and specify "traverse sub-folders" and it'll drive down into the sub-folders. Hope that helps!
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.