In
this article I am going to explain how to list all month number and name in sql
server.
In
previous article I have explained Sql server substring function, how to cleancache and buffer for sql server store procedure, Sql server STUFF function and Sqlserver CONCAT function.
Description:
SELECT number as [Month number],
DATENAME(MONTH, '2016-' + CAST(number as varchar(2)) + '-1') as [month name]
FROM master..spt_values
WHERE Type = 'P' and number between 1 and 12
ORDER BY Number
Output:
0 Comments