I'd like a simple SQL statement that returns the month name from a month number. For example, if month number = 1, I'd like 'January', if month number = 12, I'd like 'December'.
I found on an SQL forum somewhere the following statement, and although I don't understand it, I hoped that it would work...
But alas, it does not seem to work. Any idea what's wrong with this, or how to do what I want? I don't have a complete date, just a month number. (I think there's a way to get the month name from a date, so I suppose I could create a date of myMonthNumber/1/2014 and get the month name, but is there a better way?)
Thanks!
I found on an SQL forum somewhere the following statement, and although I don't understand it, I hoped that it would work...
Code:
Exec sql
set :monthName = DateName(month, DateAdd(month,:myMonthNumber,-1));
Thanks!





Comment