• No need for CASE here at all.

    SELECT Name,

    Total = ISNULL(Salary,0) + ISNULL(Bonuses,0)

    FROM dbo.YourTable

    ;

    If you insist on ANSI/ISO code, you can replace ISNULL with COALESCE. I use ISNULL to make sure the datatype stays the same as the first operand and, over millions of rows, is a bit faster than COALESCE.

    As a note for future posts, please read and heed the article at the first lik in my signature line below. Thanks.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)