I want to get the week number, and I did using DATEPAR(WEEK,DATE)
, however, one-digit week numbers do not come with a zero in front.
Basically I need to get 01, 02, 03 instead of 1, 2, 3.
Advertisement
Answer
In SQL Server, you can left pad with this logic:
select right('0' + datename(week, date), 2)