In this post, we will learn how to convert Month Number to Month Name in SQL Server.
I think this is the best way to get the month name when you have the month number.
Here is the query to convert the month number to month name in SQL Server.
Declare @MonthNumber int=1;
SELECT DATENAME(MONTH, DATEADD(MONTH, @MonthNumber , 0 ) - 1 ) As 'Month Name';
Month Name
------------------------------
January
Declare @MonthNumber int=1;
Select DATENAME(MONTH, DATEADD(MONTH, @MonthNumber, -1 ) ) As 'Month Name';
Month Name
------------------------------
January
I hope this article will help you to understand to convert month number to month name in SQL Server
Share your valuable feedback and help us to improve. If you find anything incorrect, or you want to share more information about the topic discussed above. please post your comment at the bottom of this article. Thank you!
Comments