Changing a SUM returned NULL to zero

前端 未结 6 1737
旧巷少年郎
旧巷少年郎 2021-02-05 01:54

I have a stored procedure as follows:

CREATE PROC [dbo].[Incidents]
(@SiteName varchar(200))
AS
SELECT
(  
    SELECT SUM(i.Logged)  
    FROM tbl_Sites s  
             


        
6条回答
  •  北荒
    北荒 (楼主)
    2021-02-05 02:37

    Just ran into this problem, Kirtan's solution worked for me well, but the syntax was a little off. I did like this:

    ISNULL(SUM(c.Logged), 0)
    

    Post helped me solve my problem though so thanks to all.

提交回复
热议问题