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

前端 未结 5 1048
一个人的身影
一个人的身影 2020-12-20 02:03

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 t

相关标签:
5条回答
  • 2020-12-20 02:46

    Hmmmm, I get "September", SqlServer 2005 9.00.3402.

    0 讨论(0)
  • 2020-12-20 02:47
    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...

    0 讨论(0)
  • 2020-12-20 03:02

    Nope, SELECT DATENAME(month, GETDATE()); returns September for me. I just tried it in SQL 2005 and 2008. Where are you executing this query? That may help as to why this is happening to you.

    0 讨论(0)
  • 2020-12-20 03:02

    The only thing I can think of would be collation causing that, but I can't find any specific examples of a collation that would do that. The other possibility could be the language which also sets date format. I'm a bit mystified, but these are places to start.

    0 讨论(0)
  • 2020-12-20 03:02

    Try running:

    select name ,alias, dateformat from syslanguages where langid = (select value from master..sysconfigures where comment = 'default language')

    To see what language the system thinks it's using. SqlServer changes its date format based on that.

    0 讨论(0)
提交回复
热议问题