change the following query to storedprocedure

  • yes they are the same

  • koolme_85 (1/5/2011)


    i did but now its throwing the arithematic over flow error

    Msg 8115, Level 16, State 2, Line 1

    Arithmetic overflow error converting expression to data type datetime.

    after i replaced the code with

    LEFT(DATENAME(mm,DDmasterFacts.postdatedimkey),3) + ' ' + DATENAME(yy,DDmasterFacts.postdatedimkey) AS [monthname],

    Could you post your revised code here?

  • koolme_85 (1/5/2011)


    i did but now its throwing the arithematic over flow error

    Msg 8115, Level 16, State 2, Line 1

    Arithmetic overflow error converting expression to data type datetime.

    after i replaced the code with

    LEFT(DATENAME(mm,DDmasterFacts.postdatedimkey),3) + ' ' + DATENAME(yy,DDmasterFacts.postdatedimkey) AS [monthname],

    What is the datatype of the DDmasterFacts.postdatedimkey? Credits to Navy beans says it's an INTEGER and not a DATETIME.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (1/6/2011)


    ... Credits to Navy beans ...

    Huh?

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • WayneS (1/6/2011)


    Jeff Moden (1/6/2011)


    ... Credits to Navy beans ...

    Huh?

    Think "Dollars to Donuts". 😉

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 5 posts - 16 through 19 (of 19 total)

You must be logged in to reply to this topic. Login to reply