Hi Peeps,
I have a case statement as below which returns me Week CW00 for week ending date '2017-01-01', I need to get CW52 instead of it.
,CASE
WHEN DATEPART(wk,pdth.week_ending_date) < 10 THEN 'CW0' + CONVERT(NVARCHAR(2),DATEPART(wk,pdth.week_ending_date)-1)
ELSE 'CW' + CONVERT(NVARCHAR(2),DATEPART(wk,pdth.week_ending_date)-2)
END AS week_number
any ideas on how i can i achieve this?
Thanks