I am trying to build a dynamic connection string in SSIS using the Expression builder. The files I want to connect to have a naming convention that ends with the current date in the format - Oct 10 2019. The problem I have, is that when the day part of the date is single digits, there are two whitespaces between the month part and the day part. e.g - Extract Oct__9 2019.
The expression I have so far only works for single-digit days:
@[User::OpenCasesLoadDir] + "Open Exception Reporting Cases- Extract "+
(MONTH(getdate()) == 1 ? "Jan" : MONTH(getdate()) == 2 ? " Feb" : MONTH(getdate()) == 3 ? "Mar" :
MONTH(getdate()) == 4 ? "Apr" : MONTH(getdate()) == 5 ? "May" : MONTH(getdate()) == 6 ? "June" :
MONTH(getdate()) == 7 ? "July" : MONTH(getdate()) == 8 ? "Aug" : MONTH(getdate()) == 9 ? "Sep" :
MONTH(getdate()) == 10 ? "Oct" : MONTH(getdate()) == 11 ? "Nov" : MONTH(getdate()) == 12? "Dec":"")
+ " " + (DT_STR,4,1252)DAY( DATEADD( "dd", -1, getdate() )) + " " + (DT_STR,4,1252)YEAR( DATEADD( "dd", -1, getdate() )) + ".csv"
Is there way to adapt this expression so that there are two leading white spaces for single-digit days and one leading white space for double digit days?