SQL Server the closest 1st February

Viewed 68

Could you please help in finding the closest February 1st to current date?

The following script works correctly only if it is ran in current year:

select DATEADD(MONTH,1,DATEADD(year, DATEDIFF(year, -1, GETDATE()), 0))

But when it would be ran in January next year it will produce incorrect result.

Thank you in advance!

4 Answers
Related