Transact SQL Other Articles Software Reviews
SQL Server Help: How to find the month name in Transact-SQL
The SQL GetDate() function can be used to return the current date in SQL. There is also a Month function that will return the numerical value of the DateTime variable's month value:
SELECT MONTH(GetDate()) as 'month'
For Month, January = 1 and December = 12.
To get the month name you need to use the SQL DateName function. This takes two arguments, the part of the date you want and the DateTime variable. The SQL statement below shows the current month name:
SELECT DateName(m, GetDate()) AS 'month'
The month name is returned as a nvarchar data type. This also works for retrieving the current month name:
SELECT DateName(mm, GetDate()) AS 'month'