DATENAME(MONTH,GETADATE()) 将月份的数值返回为“09"

当我运行以下查询 [SELECT DATENAME(MONTH,GETDATE())] 时,理想情况下它的返回值应为September",但其返回值应为09".我在 MS SQL Server 2005 上运行此查询.我需要使用 MS SQL Server 2005 配置什么吗?

请查找SQL Server 2005的详细信息

<上一页>组件名称版本--------------------------------------------------------------------Microsoft SQL Server 管理工作室 9.00.1399.00Microsoft 分析服务客户端工具 2005.090.1399.00Microsoft 数据访问组件 (MDAC) 2000.086.3959.00 (srv03_sp2_rtm.070216-1710)微软 MSXML 2.6 3.0 4.0 5.0 6.0微软 Internet Explorer 6.0.3790.3959微软 .NET 框架 2.0.50727.42操作系统 5.2.3790

解决方案

SELECT @@LANGUAGE ->给一个亚洲人?设置语言日语选择日期名称(月份,GETDATE())设置语言 us_english选择日期名称(月份,GETDATE())

DATENAME 取决于语言,所以需要更改服务器默认值或您的登录默认语言...

谢谢你和sayon​​ara...

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?

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

解决方案

SELECT @@LANGUAGE -> gives an Asian one?

SET LANGUAGE Japanese
SELECT DATENAME (month, GETDATE())

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

DATENAME depends on language, so need to change server default or your login default language...

Thank you and sayonara...

相关文章