DeniseGoodheart
asked on
COALESCE and ISNULL Functions Not Returning 0 Value
Hi,
I'm using SQL Server 2000. I would like my RecordCount column to return a 0 value. The RecordCount is a numeric value. I've tried the COALESCE and IsNull functions with no success as follows:
SELECT COUNT(COALESCE (ItemCount, 0)) AS RecordCount
FROM dbo.CAR_SummaryTable
GROUP BY ItemCategory
HAVING (ItemCategory = 'Unincorp Central Region')
SELECT COUNT(ISNULL(ItemCount, 0)) AS RecordCount
FROM dbo.CAR_SummaryTable
GROUP BY ItemCategory
HAVING (ItemCategory = 'Unincorp Central Region')
Any Suggestions?
Thanks,
Denise
I'm using SQL Server 2000. I would like my RecordCount column to return a 0 value. The RecordCount is a numeric value. I've tried the COALESCE and IsNull functions with no success as follows:
SELECT COUNT(COALESCE (ItemCount, 0)) AS RecordCount
FROM dbo.CAR_SummaryTable
GROUP BY ItemCategory
HAVING (ItemCategory = 'Unincorp Central Region')
SELECT COUNT(ISNULL(ItemCount, 0)) AS RecordCount
FROM dbo.CAR_SummaryTable
GROUP BY ItemCategory
HAVING (ItemCategory = 'Unincorp Central Region')
Any Suggestions?
Thanks,
Denise
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi ExpertAdmin,
No, I was missing the point. I'm working on a project where the project due date is based on the budget due date, and not the actual time required for the project. In any event, sometimes I lose perspective in what I'm doing because I'm trying to meet the aggressive project due date! I am so thankful for Experts Exchange!
Many Thanks,
Denise
No, I was missing the point. I'm working on a project where the project due date is based on the budget due date, and not the actual time required for the project. In any event, sometimes I lose perspective in what I'm doing because I'm trying to meet the aggressive project due date! I am so thankful for Experts Exchange!
Many Thanks,
Denise
ASKER
Hi angelIII:
Many thanks for your useful information!
Denise
Many thanks for your useful information!
Denise
Anytime. Glad I could help. I have been on a few of those projects myself.
M@
M@
SELECT ISNULL(COUNT(ItemCount), 0) AS RecordCount
FROM dbo.CAR_SummaryTable
GROUP BY ItemCategory
HAVING (ItemCategory = 'Unincorp Central Region')