• Luis Cazares (5/11/2014)


    Your query looks just like mine but using a while loop instead of a single operation. Why would you do that.

    Because and like he said, he's a C# procedural programmer just making his first move from a procedural language to a declarative language and hasn't yet made the necessary paradigm shift. 🙂 Based on how he formatted the code and the fact that he understands the use of NEWID() in conjuction with modulus to produce a constrained random integer, he'll get it. It's just going to take some time like the first time most of us started working with T-SQL.

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