How to display a month name from an input of a month index (i.e. 1-12).
The script below will return the month name for a given month index.
DECLARE @MonthID int
SET @MonthID = 5
SELECT DateName(month, convert(datetime, '2009-' + cast(@MonthID as varchar) + '-01', 120))
@MonthID could be any integer I have only declared a new variable here for completeness.
Comments