I met a question, my customer wants me to output a table, if the value of a column is NULL, then output 0, what function should I use to do this?
Thank you,Adriaan. I just tested it, it works! Any other ways to do it, I think it must be at least 3 way to do it!
ISNULL is more to the point than the two alternatives that I know: SELECT CASE WHEN MyColumn IS NULL THEN 0 ELSE MyColumn END FROM MyTable SELECT COALESCE(MyCoumn, 0) FROM MyTable If you're coming from a regular programming language, perhaps you think that this ... SELECT MyColumn + 0 ... might work, but NULL plus anything is still NULL in T-SQL.
>>I think it must be at least 3 way to do it! How did you think without knowing any syntaxes? Madhivanan Failing to plan is Planning to fail