Sum(ISNULL(GSTExclusiveAmt,0))

  • Can any one explain me what this means 🙂

    Sum(ISNULL(GSTExclusiveAmt,0))

    Regards,

    Prathyusha

  • prathyushaa (11/4/2009)


    Can any one explain me what this means 🙂

    Sum(ISNULL(GSTExclusiveAmt,0))

    Regards,

    Prathyusha

    Take the field GSTExclusiveAmt and if it is NULL replace NULL with 0, then sum it with all the other rows..

    Really, you could have looked up each of the functions and found this out pretty easily yourself..

    CEWII

  • http://msdn.microsoft.com/en-us/library/ms187810.aspx

    http://msdn.microsoft.com/en-us/library/ms184325.aspx

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks CEWII but the thing is that i'm a beginner in SQL .

    I work as a Systems Tester and dont have much knowledge about Basic Funda's about SQL.

  • prathyushaa (11/4/2009)


    Thanks CEWII but the thing is that i'm a beginner in SQL .

    I work as a Systems Tester and dont have much knowledge about Basic Funda's about SQL.

    Still a search for ISNULL and SUM would have yielded this in books online was my point..

    CEWII

  • Thanks for your help and letting me know the sources for SQL

  • Ummm... looking up the two functions in Books Online is certainly the way to go folks, but stop and think about WHY someone wrote the code like that. SUM won't include NULLS so logically, there's no reason for the ISNULL... there is, however, a technical reason for it that won't be obvious by reading Books Online. Any of you know what it might be? I'll give you a hint... the code was written this way to prevent an unwanted return that the GUI could interpret as an error return. What is that unwanted return and how does the code prevent it?

    {insert Jeopordy theme song here} 😛

    --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)

  • [font="Courier New"]Warning: Null value is eliminated by an aggregate or other SET operation.[/font]

    (suppressed by SET ANSI_WARNINGS OFF)

  • Paul White (11/6/2009)


    [font="Courier New"]Warning: Null value is eliminated by an aggregate or other SET operation.[/font]

    (suppressed by SET ANSI_WARNINGS OFF)

    Correct on both counts... except for distributed transactions (IIRC).

    --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 9 posts - 1 through 8 (of 8 total)

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