"D:\Sales" +
(DT_WSTR,4)DATEPART("yyyy", DATEADD("month", -1, GETDATE())) +
RIGHT("0" + (DT_WSTR,2)DATEPART("mm", DATEADD("month", -1, GETDATE())), 2) +".csv"
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I'm trying to change a file name to current year and Previous month with below script but it is still coming as current year and current month. I tried around to fix it but no luck.
If anyone can show my mistake please
"D:\Sales" + (DT_WSTR,4)DATEPART("yyyy",GetDate()) +
RIGHT("0" + (DT_WSTR,2)DATEPART("mm",GetDate()) ,2) + ".csv"
"D:\Sales" +
(DT_WSTR,4)DATEPART("yyyy", DATEADD("month", -1, GETDATE())) +
RIGHT("0" + (DT_WSTR,2)DATEPART("mm", DATEADD("month", -1, GETDATE())), 2) +".csv"