Friday, June 24, 2016

Month Name List in SQL Server

//Month Name List in SQL Server

SELECT number,
DATENAME(MONTH, CAST(year(getdate()) as varchar(4)) +'-' + CAST(number as varchar(2)) + '-1') monthname

FROM master..spt_values
WHERE Type = 'P' and number between 1 and 12
ORDER BY Number




No comments: