Here is the code I tried
SELECT
case when InsertedRows is null then 0 else InsertedRows end InsertedRows
,case when FailedRows is null then 0 else FailedRows end FailedRows
,case when UpdatedRows is null then 0 else UpdatedRows end UpdatedRows
,InsertedRows + UpdatedRows + FailedRows as tot
FROM PATS.ImportLog
WHERE CreatedBy='suvaneeth'
AND ISNULL(CompletedYN,0) = 0
AND CAST(CreatedDate AS date) >= CAST(GETDATE() AS date)
and I get the result for tot is NULL
99 0 0 NULL
I'm expecting the result is 99
NULL + 0 = NULLtotcolumn in the result just adds them directly, without regarding to nulls. There is at least one in either of them.