Skip to content

Instantly share code, notes, and snippets.

@greggnakamura
Last active April 26, 2017 15:17
Show Gist options
  • Save greggnakamura/fea9d1c32d09f1b7984452d6502a76af to your computer and use it in GitHub Desktop.
Save greggnakamura/fea9d1c32d09f1b7984452d6502a76af to your computer and use it in GitHub Desktop.
SQL: Get Date Month Number and Date Month Name from Date field
SELECT DISTINCT
DATEPART(M, SeminarDate) AS MonthPart,
DATENAME(M, SeminarDate) AS MonthName
FROM customtable_MedicareSeminarDates
ORDER BY MonthNo ASC
-- output
MonthNo MonthName
1 January
6 June
11 November
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment