Is it safe to use SUM() without ISNULL()

后端 未结 4 864
轮回少年
轮回少年 2021-02-18 14:14

I am trying to hence the performance of an SP. I have a doubt in my mind about SUM and ISNULL. When I sum up a column, should I use ISNULL? Is it SAFE to use SUM() without ISNUL

4条回答
  •  终归单人心
    2021-02-18 15:05

    Yes its safe . You can use Sum without handling NULL Value. You can also check that.

    You can use like that also.

    ISNULL(SUM(COL1),0).

    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.

    For Reference : https://msdn.microsoft.com/en-IN/library/ms187810.aspx

提交回复
热议问题