Saturday, February 25, 2012

Convert Null to 0

Hi,

What would be the Syntax in a SELECT statement to convert a Null Value to 0,

ie,

SELECT RowID, Amount FROM TableA

and Amount is a smallmoney field. For example it is coming back with:


RowID Amount
1 2.3000
2 15.0300
3 NULL
4 7.8900

But I want it to return:

RowID Amount
1 2.3000
2 15.0300
3 0.0000
4 7.8900

ThanksYou can use IsNull() for this, e.g. IsNull(Amount, 0).|||Thanks, that is what I was looking for. Works great

No comments:

Post a Comment