• sipas (8/26/2016)


    sknox (8/25/2016)


    The correct answer is "it depends."

    MOST of the time you'll get two rows as explained in the answer.

    HOWEVER, each GETDATE() within each SELECT is evaluated separately. When the separate evaluations cross a 3-millisecond boundary, you'll get 3 rows instead of 2.

    To test this, run the code with GO 100 after it in SSMS, and look at the total result count. You may have to run this multiple times to cross a boundary, but sometimes the row count will be greater than the expected 200.

    Theoretically, it's possible to get 4 or 5 rows, but you'd need an incredibly slow or stressed system to take over 3 milliseconds (crossing at least two 3-millisecond boundaries) to evaluate 5 GETDATE() calls.

    +1

    +1