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 Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>