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 2008 Forums
 SSIS and Import/Export (2008)
 Loading 7 days files with specific names in SSIS

Author  Topic 

nitin1309
Starting Member

3 Posts

Posted - 2011-12-02 : 12:46:22
Hello Everybody,
I have a folder which gets a daily dump of 7 or 8 .xls files. Among all those files, I just need to load 2 files with a specific name.. ABC_datestamp.xls and XYZ_datestamp.xls.

The problem is I am not able to isolate these 2 file names because there are so many other files in the same folder. The second challenge is that my manager wants me to load all files from last week at once, which means I have to specifically load files from last 7 days only.

Right now I am copying those specific 7 files in to a folder and then loading it using a for each loop container.

Is there anyway, I can use a script task to generate the file names like ABC_02-Dec-2011.xls, ABC_01-Dec-2011.xls, ABC_30-Nov-2011.xls .......last 7 days files and pass it as a variable to a DATA FLOW TASK?

Any better suggestions ?

I know a lot of people have asked similar questions but I am new to SSIS and not able to find good answers.

Thanks a lot..

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-02 : 12:51:30
you can use for each loop container to iterate through files in folder. you can give pattern of filename to look for inside the folder. Also for processing only last 7 days file you can add a script task inside loop to check filename for last 7 date pattern inside and then process only ones having it

see below to get start on this

http://www.sqlis.com/sqlis/post/Looping-over-files-with-the-Foreach-Loop.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -