Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have the below sql code.
'F' + right(convert(varchar,datepart(mm, DATEADD(MONTH, -3, Period))),2) + '-' + convert(varchar(3),datename(month, Period)) as FinMonth
which is giving results like
F1-Apr, F2-May.....F12 March.
Is there any way that I can add "year" as well ?... just like F1-Apr13, F2-May13......F12Mar12.
Thanks
'F' + right(convert(varchar,datepart(mm, DATEADD(MONTH, -3, Period))),2) + '-' + convert(varchar(3),datename(month, Period)) + right(text(year(Period))) as FinMonth
Thanks for your reply Greg. Right(text(year(period))) is not working. I tried with right(datepart(year,Period),2) and it is working fine. Thanks anyway!