• mtassin (3/23/2009)


    r.hensbergen (3/23/2009)


    I like these questions a lot more than making 'SQL puzzles', just by showing bad code. Your question is a typical sample of what I run into daily. Every DBA should use ISNULL in their queries, I guess that's the lesson for today 🙂

    Actually,

    They should use COALESCE, it's much easier to use, doesn't request nesting for multiple tests and is ANSI SQL compliant.

    ISNULL may not be ANSI SQL compliant, but I think you will find it faster than COALESCE when you only need to test a single value for a null value. Using COALESCE makes sense when you have multiple values and you want the first non-null value.