• GilaMonster (9/2/2015)


    Jeff Moden (8/28/2015)


    Before you go to all that trouble, try changing "postalid" to "*" or "1" in the not exists and see what happens.

    That won't do anything. The SELECT list for an exists is completely ignored, it's not processed in any way. You can put SELECT 1/0 in an EXISTS and it'll still run fine.

    Thanks for dispelling another old myth, Gail. :blush: I'm embarrassed to admit that I've never tested the myth. That 1/0 thing looks like a way to have some fun with someone's mind. 🙂

    --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)