I have the following sql statement:
SELECT Cast(datename(month, dateadd(mm, -1, getdate())) as varchar(15)) + '-' + Cast((DATEPART(YYYY,GETDATE())) As CHAR(4))
The result displays as July-2014 which is correct for previous month...
But on next year January-2015 it will display December-2015.
Is it possible to have the date shown as December-2014?
I appreciate any help.
Thanks in advance.