I am using for each loop container in ssis. I need to extrat excel file from my folder. example file names:- january 2012, march 2012 etc. My problem is i need to extract only current month file (which is October 2012). Any idea?
Asked
Active
Viewed 875 times
0
-
A bit confused, I assume you do not know how file name is named ? – Farfarak Oct 25 '12 at 15:20
1 Answers
2
If you're processing one single file, there's no need for a loop. You only need an expression that can convert date to English (days or months).
One example explaining both cases is shown here: http://sqlage.blogspot.ch/2011/03/monthname-and-day-name-in-ssis.html
The expression that is solving your problem is:
(MONTH(getdate()) == 1 ? "January" :
MONTH(getdate()) == 2 ? "February" :
MONTH(getdate()) == 3 ? "March" :
MONTH(getdate()) == 4 ? "April" :
MONTH(getdate()) == 5 ? "May" :
MONTH(getdate()) == 6 ? "Jun" :
MONTH(getdate()) == 7 ? "July" :
MONTH(getdate()) == 8 ? "August" :
MONTH(getdate()) == 9 ? "September" :
MONTH(getdate()) == 10 ? "October" :
MONTH(getdate()) == 11 ? "November" :
MONTH(getdate()) == 12? "December":"") + " " +
(DT_WSTR,4)YEAR(getdate()) + ".xlsx"
The result is (at the moment): October 2012.xlsx

milivojeviCH
- 1,580
- 14
- 29