casting integer to month

Hi,

in the database that we use for learning reporting services a month is saved as an integer in a column. In the report I would like to have the month fully written istead of the numbers 1 to 12. Is this possible with the CAST function or the CONVERT function, I can't find the exact information in the msdn.

greetings


Answer this question

casting integer to month

  • Klaus-Dieter

    Oh it's easy
    the function is:

    =MonthName(Fields!maand.Value)
    you can place it an your tabel in your layout
    it's a visual basic function apparently

  • plshn99

    My post was TSQL syntax, if you want to format that inyour code (VBScript) you have to do something like =FORMAT("MM",yourdate) or =MONTH(Yourdate), sorry but I don’t have the syntax right in my mind, perhaps you can check the help file form the report builder.


    HTH, Jens Suessmeyer.

  • FlyingHigh

    oh and it didn't worked ;)

  • pebelf

    I tried to use the function DATENAME in the field where the month should appear. 'Fields!maand.Value' is the value from the database.

    =DATENAME(mm,DATEADD(dd,-1,DATEADD(mm,Fields!maand.Value)))

  • DBRGSS

    Hi,

    as far as I know, there is only DATENAME which produces the name of the Month, perhaps you make a function out of that:

    CREATE FUNCTION MonthName
    (
    @Month TINYINT
    )
    RETURNS VARCHAR(20)
    AS
    RETURN (Select DATENAME(mm,DATEADD(dd,-1,DATEADD(mm,@Month,0))))

    HTH, Jens Suessmeyer.

    ---
    http://www.sqlserver2005.de
    ---


  • VDeepak

    Creating a new function would do the trick indeed but I am working in a limited version of Visual Studio that only allows us to do reporting services...

  • casting integer to month