SQL Server Performance

MonthName

Discussion in 'General Developer Questions' started by Akthar, Sep 20, 2006.

  1. Akthar New Member

    Hi all,

    can can i easily retrieve the monthname from a datatime field

    AKTHAR
  2. satya Moderator

    Referto DATEPART function in Books online.

    Satya SKJ
    Microsoft SQL Server MVP
    Contributing Editor & Forums Moderator
    http://www.SQL-Server-Performance.Com
    This posting is provided AS IS with no rights for the sake of knowledge sharing.
  3. sudiptakr New Member

    Simple use the month function.
    like

    select month(CREATED_ON)
    from Order_Details
  4. Akthar New Member

    I TRIED monthname(date) and it work fine

    Thanks

    AKTHAR
  5. sudiptakr New Member

    Previous relpy only gives you the number of month.
    This function gives you desire result.
    SELECT DATENAME(month, getdate()) AS 'Month Name'
  6. dineshasanka Moderator

    quote:
    I TRIED monthname(date) and it work fine

    what, there is no function called monthname buit into sql server 2000



    ----------------------------------------
    Contributing Editor, Writer & Forums Moderator
    http://www.SQL-Server-Performance.Com

  7. Akthar New Member

    i am currently on Sql 2005

    AKTHAR
  8. dineshasanka Moderator

  9. dineshasanka Moderator

    this is what i got when I execute
    select monthname(getdate())

    Msg 195, Level 15, State 10, Line 1
    'monthname' is not a recognized built-in function name.

    ----------------------------------------
    Contributing Editor, Writer & Forums Moderator
    http://www.SQL-Server-Performance.Com

  10. Akthar New Member

    oops,, wrongly posted, sorry guys

    AKTHAR
  11. Akthar New Member

    thanks sudiptakr, the code works fine on Sql 2000

    AKTHAR

Share This Page