LastDayPreviousMonth / FirstDayCurrentMonth

,

The fastest way of getting
LastDayPreviousMonth / FirstDayCurrentMonth

SELECT DATEADD(dd, CAST(DATEDIFF(DAY,'17530101',CURRENT_TIMESTAMP) AS int)
                  - DAY(CURRENT_TIMESTAMP), '17530101') 
as LastDayPreviousMonth

SELECT DATEADD(dd, CAST(DATEDIFF(DAY,'17530101',CURRENT_TIMESTAMP) AS int)
                  - DAY(CURRENT_TIMESTAMP) + 1, '17530101') 
as FirstDayCurrentMonth

Rate

5 (1)

Share

Share

Rate

5 (1)