TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Get Month Name And Number In SQL SERVER
Nikhil Sangani
Jul 26
2016
Code
1.2
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
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
OUTPUT
Number monthname
1 January
2 February
3 March
4 April
5 May
6 June
7 July
8 August
9 September
10 October
11 November
12 December
Get Month Name
Number In SQL SERVER
SQL SERVER