SyntaxFix
Write A Post
Hire A Developer
Questions
append 0 before it by checking if the value falls between 1 and 9 by first casting it to varchar
select case when DATEPART(month, getdate()) between 1 and 9 then '0' else '' end + cast(DATEPART(month, getdate()) as varchar(2))