Here is an exact answer on your question: pass-first-and-last-day-of-the-previous-month-in-ssis-execute-sql-task
Please help to get the SSIS expression of First Day and Last Day of Previous month
Subhomoy Chakraborty
106
Reputation points
Can anybody please help me to get the SSIS expression of First Day and Last Day of Previous month in the below format.
yyyy-mm-dd.
Currently I am hardcoding it as 2022-09-01 and 2022-09-30 respectively.
Any suggestion will be helpful.
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,704 questions
2 answers
Sort by: Most helpful
-
-
ZoeHui-MSFT 41,496 Reputation points
2022-10-07T01:57:34.813+00:00 First Day:
(DT_WSTR, 4)YEAR(DATEADD("mm", -1, GETDATE())) +"-"+ RIGHT("0" + (DT_WSTR,2)MONTH(DATEADD("mm", -1, GETDATE())),2)+"-"+"01"
Last Day:
(DT_WSTR,4) YEAR(DATEADD( "day", -DAY( GETDATE() ) ,GETDATE())) + "-" +RIGHT("0"+(DT_WSTR,2) MONTH(DATEADD( "day", -DAY( GETDATE()),GETDATE()) ), 2) +"-"+RIGHT("0"+(DT_WSTR,2) DAY(DATEADD( "day", -DAY( GETDATE()) ,GETDATE()) ),2)
Regards,
Zoe Hui
If the answer is helpful, please click "Accept Answer" and upvote it.