OVER() and NULL values

  • The column [hrsfacil] contains many NULL values, still the sum of [hrsfacil] is correct using the OVER clause. Why don't I need to use ISNULL(hrsfacil,0) ?

    Cheers,

    Julian

    SUM([hrsfacil]) OVER() AS Facil
  • From the documentation (emphasis mine):

    Returns the sum of all the values, or only the DISTINCT values, in the expression. SUM can be used with numeric columns only. Null values are ignored.

    John

  • Great, thank you John!

    J.

  • question is also, why is NULL allowed? Is that an issue that needs addressed so that the SUM is actually correct data? Simply because it handles the situation doesn't mean that it is not a problem for someone.

    -------------------------------------------------------------------------------------------------------------------------------------
    Please follow Best Practices For Posting On Forums to receive quicker and higher quality responses

Viewing 4 posts - 1 through 3 (of 3 total)

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