Random unions

  • Nice question. Thanks for sharing

  • SELECT

    RAND(100)

    , RAND(7)

    , RAND()

    UNION ALL

    SELECT

    RAND(100)

    , RAND(7)

    , RAND()

    UNION ALL

    SELECT

    RAND(100)

    , RAND(7)

    , RAND()

    ;

    go

    returns

    ---------------------- ---------------------- ----------------------

    0.715436657367485 0.713703791040473 0.945719735396816

    0.715436657367485 0.713703791040473 0.945719735396816

    0.715436657367485 0.713703791040473 0.945719735396816

    (3 row(s) affected)

    Why, it is not supposed to ??

  • TomThomson (10/23/2014)


    Amusing question; the use of RAND is an interesting distraction for a question that is really about UNION ALL and nothing else.

    I agree! It would have been UNION instead of a UNION ALL to make it less obvious.

    /Håkan Winther
    MCITP:Database Developer 2008
    MCTS: SQL Server 2008, Implementation and Maintenance
    MCSE: Data Platform

  • Thanks for the question.

Viewing 4 posts - 16 through 18 (of 18 total)

You must be logged in to reply to this topic. Login to reply