Subject Re: coerce null to 0
Author Adam
--- In, bill_lam <bill_lam@...> wrote:
> is there any method to coerce possible null from aggregate function
to zero,

You found the 1% from my previous response.

> eg
> select sum(amt) from balc where 1=0
> it returns null, but I want 0 instead.

The Coalesce function converts null to whatever you want. So

select Coalesce(sum(amt), 0) from balc where 1=0

Of course I would hope you never actually do a 'where 1=0' in real
life. It evaluates for every record.