January 7, 2024 at 7:41 am
Should I see this warning when I have ISNULL check at SUM function and changing NULLs to 0?
Thank you
January 7, 2024 at 9:19 am
Should I see this warning when I have ISNULL check at SUM function and changing NULLs to 0?
Thank you
No. As demonstrated below.
DROP TABLE IF EXISTS #x;
CREATE TABLE #x
(
SomeValue INT
);
INSERT #x
(
SomeValue
)
VALUES
(NULL)
,(1)
,(2);
SELECT TotValue = SUM (ISNULL (x.SomeValue, 0))
FROM #x x;
If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.
January 7, 2024 at 9:19 am
--Removed duplicate
If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.
January 7, 2024 at 5:18 pm
Should I see this warning when I have ISNULL check at SUM function and changing NULLs to 0?
As Phil pointed out - you can eliminate that message. If you are still seeing the message - then it is most likely because of where you placed the ISNULL function.
For any further help - we would need to see the code you are executing where you are using ISNULL and still getting that warning.
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
January 7, 2024 at 7:48 pm
well... what Phil posted will remove the message - but the other way you may be using the isnull will not
so if you do the alternative to Phil's. where you put the isnull OUTSIDE the sum, that will still give you the message - so likely this is what you are doing.
SELECT TotValue = ISNULL (SUM (x.SomeValue), 0)
FROM #x x;
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply