DATENAME(MONTH,GETADATE()) is returning numeric value of the month as ‘09’

Asked By Praful K
30-Sep-09 09:41 AM
Earn up to 0 extra points for answering this tough question.

Hi,

When I run the following query [SELECT DATENAME(MONTH,GETDATE())], ideally speaking it should return value as 'September' but its returning value as '09'. I am running this query on MS SQL Server 2005. Is there anything I need to configure with MS SQL Server 2005? My requirement is to get month name, if not by DATENAME is there any way to get the name of the month?

 

Please find the details of the SQL Server 2005

 

Component Name                                Version

--------------------------------------------------------------------

Microsoft SQL Server Management Studio           9.00.1399.00

Microsoft Analysis Services Client Tools      2005.090.1399.00

Microsoft Data Access Components (MDAC)       2000.086.3959.00 (srv03_sp2_rtm.070216-1710)

Microsoft MSXML                                               2.6 3.0 4.0 5.0 6.0

Microsoft Internet Explorer                               6.0.3790.3959

Microsoft .NET Framework                               2.0.50727.42

Operating System                                           5.2.3790

  RE: DATENAME(MONTH,GETADATE()) is returning numeric value of the month as ‘09’

Jonathan VH replied to Praful K
30-Sep-09 10:11 AM

It sounds as though the language is Asian.  Japanese, Korean, and Simplified Chinese all display months like that.

What do you get when you execute this statement?

SELECT @@LANGUAGE;

Here's a short script to see the effects of the language:

SET LANGUAGE N'Japanese';
SELECT DATENAME(m,GETDATE());
SET LANGUAGE 'us_english';
SELECT DATENAME(m,GETDATE());

To see the possibilities:

EXEC sp_helplanguage;

  The Japanese and Korean languages return the month in digits.

[)ia6l0 iii replied to Praful K
30-Sep-09 10:29 AM
However, before you execute your datename script, you can set the language to US English

Like,
SET LANGUAGE us_english
SELECT DATENAME(month,GETDATE())

Create New Account