In this case we want to extract a two digit month for the past month !

RIGHT('00' + CONVERT(NVARCHAR(2), DATEPART(MONTH, dateadd(m,-1,GETDATE()))), 2)

Thanks to my friend Louis on this one that saved me !

Tagged with:  

select * from TABLE where DATETIME_FIELD between CAST(GETDATE() AS DATE) AND DATEADD(DAY, 1, CAST(GETDATE() AS DATE))

Tagged with: