Getting month names with tsql

A quick tip using tsql to get a list of the month names.

SELECT Number + 1 as [Number],
DateName(mm,DateAdd(mm,Number,0)) as [Name]
FROM master..spt_values
WHERE Type = ‘P’ and Number < 12

Shamelessly copied from somewhere on the Internet… 😉

Leave a Reply

%d bloggers like this: