How To Get Month Name From Date In SQL Server

Recently, I got the requirement to get the month name from a specified date in SQL server. This article will discuss multiple approaches to achieve this functionality.

How To Get Month Name From Date In SQL Server

Let us discuss all the approaches individually.

Approach-1 Using DATENAME()

We can use the DATENAME() in an SQL query, as mentioned below.

SELECT DATENAME(MONTH, GETDATE()) AS MonthName;

After executing the above query, I got the expected output as shown below.

How To Get Month Name From Date In SQL Server

Alternatively, We can use the query as mentioned below.

SELECT LEFT(DATENAME(MONTH,Getdate()),3) as MonthName

After executing the above query, I got the expected output, as shown below.

Get Month Name From Date In SQL Server

Approach-2 Using Format()

We can use the Format() in an SQL query, as mentioned below.

Select Format(GetDate(),'MMMM') as MonthName

After executing the above query, I got the expected output, as shown in the screenshot below.

how to get short month name from date in sql server

Approach-3 Using CHOOSE()

We can also use the CHOOSE() using the below query.

SELECT CHOOSE(DATEPART(MONTH, GETDATE()), 
       'January', 'February', 'March', 'April', 'May', 'June', 
       'July', 'August', 'September', 'October', 'November', 'December') AS MonthName;

After executing the above query, I got the expected output as shown below.

get month name from date sql server

Approach-4: Using Convert()

We can also use the below query using the Convert() to retrieve the month name from the date in SQL Server.

Select CONVERT(varchar(3), DATENAME(MONTH, GetDate())) AS MonthName

After executing the above query, I got the expected output, as shown in the screenshot below.

sql month name 3 character

Conclusion

You can get month name from date in SQL Server using any of this method mentioned in this article. you need to choose the best method based on your requirement.

You may also like following the articles below.

Top 200 SQL Server Interview Questions and Answers

Free PDF On Top 200 SQL Server Interview Questions And Answers

Download A 40 pages PDF And Learn Now.