• jhager (7/5/2013)


    Thanks all for replying; although I was aware of the "precedence" feature of COALESCE, I didn't realize that literal values would be typed differently, in this case 99 as an INT. Thanks for the code to determine type, I'll have to check many other code objects as we use COALESCE quite frequently in our work.

    ~ Jeff

    If you are using COALESCE() where you might use ISNULL() - as in your first post - then you might benefit from reading this Adam Machanic article.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden