blberger
asked on
Need to return a 2 digit month and day in SSIS expression builder
I need to return a leading zero when the month and or the day value is less than 10 when the SSIS expression builder code computes the new filename on a daily bassis. But the attached code does not do that and I have a very short period to fix this. I have looked at the on-line documentation, but the functions for SSIS expression builder are not clearly documented, or at least I am not seeing descriptions or examples. I would appreciate assistance
"\\" + "\\" + "KUCY2GENIDB01" + "\\" + "MarketingData" + "\\" +
(DT_WSTR,2) Month(GetDate()) +
(DT_WSTR,2) Day(GetDate()) +
(DT_WSTR,4) Year(GetDate()) +
"_CallData.csv" +
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I just needed to set the Date function in your solution to the GetDate() format and your solution did the trick that I needed. I appreciate the quick assistance.
Ok..
here you have all the expression... only copy and paste into your Derived Column inside your Dataflow.
"\\" + "\\" + "KUCY2GENIDB01" + "\\" + "MarketingData" + "\\" + (DT_STR,4,1252)(DATEPART(" yyyy",GETD ATE())) + (LEN((DT_STR,2,1252)(DATEP ART("MM",G ETDATE())) ) == 2 ? (DT_STR,2,1252)(DATEPART(" MM",GETDAT E())) : "0" + (DT_STR,2,1252)(DATEPART(" MM",GETDAT E()))) + (LEN((DT_STR,2,1252)(DATEP ART("dd",G ETDATE())) ) == 2 ? (DT_STR,2,1252)(DATEPART(" dd",GETDAT E())) : "0" + (DT_STR,2,1252)(DATEPART(" dd",GETDAT E()))) + "_CallData.csv"
FormatDate-yyyyMMdd.JPG
here you have all the expression... only copy and paste into your Derived Column inside your Dataflow.
"\\" + "\\" + "KUCY2GENIDB01" + "\\" + "MarketingData" + "\\" + (DT_STR,4,1252)(DATEPART("
FormatDate-yyyyMMdd.JPG
Open in new window