OUTPUT & NEWID()

  • Jason Selburg

    SSC-Insane

    Points: 24560

    Comments posted to this topic are about the item OUTPUT & NEWID()

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • M&M

    SSC-Insane

    Points: 21679

    Good question. Thanks

    M&M

  • Ron McCullough

    SSC Guru

    Points: 63877

    From:

    http://dictionary.reference.com/browse/guarantee

    "something that assures a particular outcome or condition:"

    Sorry but my language comprehension is that means the ONLY answers are 2 or 9 or 11 and NEVER another value.

    But the given explanation is

    Surprisingly, there can be any number of rows from ZERO to the number of rows in the table being deleted from

    contradicts what is supposedly the correct answer.

    Oh well, another question that does not rely on the workings of the database engine, but rather english comprehension.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • khelloufsofiane 6183

    SSC Eights!

    Points: 862

    Hello,

    I think the correct answer is none of the above, because the result can be 8 for example,

    and any of the above means the result must be 2 , 9 or 11 and not another value.

    anywhere thanks for the question.

  • Brigadur

    SSCrazy

    Points: 2097

    I answered "None of the above". After getting the explanation I still claim I answered right. The question was "... how many rows are gauranteed ...", so answer "Any of the above", well, questionable.

    Interesting question though

  • Ninja's_RGR'us

    SSC Guru

    Points: 294069

    Echoing here... since you're talking about garanteed # of rows, none is the only possible answer.

  • Richard Sisk

    SSCrazy

    Points: 2697

    Jeez, I hate it when the answer depends more on figuring out the author's intent in the answer than actually answering the question.

    If the answer is any number of rows can be returned, then 2, 9, or 11 are NOT guaranteed.

  • rfr.ferrari

    SSCertifiable

    Points: 6879

    great question! Initially, I analyzed the text in question and then I found the command's return is not fixed, after running it several times, really it can be any value according the correct answer.


    [font="Times New Roman"]rfr.ferrari[/font]
    DBA - SQL Server 2008
    MCITP | MCTS

    remember is live or suffer twice!
    the period you fastest growing is the most difficult period of your life!
  • roger.plowman

    SSChampion

    Points: 10135

    Am I the only one who thinks "none of the above" is the correct response, because the script is so buggy it won't compile?

    Unless I'm crazy you can't insert 'a' into the nDex field because nDex is an integer. When that script is copied to SSMS you get 3 incorrect sytax errors.

    So the correct answer is "none of the above". 🙂 Because it's *guaranteed* you won't get any return values!

  • Ninja's_RGR'us

    SSC Guru

    Points: 294069

    roger.plowman (4/25/2011)


    Am I the only one who thinks "none of the above" is the correct response, because the script is so buggy it won't compile?

    Unless I'm crazy you can't insert 'a' into the nDex field because nDex is an integer. When that script is copied to SSMS you get 3 incorrect sytax errors.

    So the correct answer is "none of the above". 🙂 Because it's *guaranteed* you won't get any return values!

    The insert will fail in 2k5, you have to change it to union alls... other than that the script will work (tho not as obviously intented and hence the question here)

  • Jason Selburg

    SSC-Insane

    Points: 24560

    It is a question of semantics. You are guaranteed to have ANY of those values and NONE of them at the same time. There is no guarantee, and yet there is one.

    **YES THIS IS A TRICK QUESTION**

    It's intent was to get you thinking, and spark conversation on the validity of Microsoft's statement that this is by design and not a bug.

    I've asked Mr. Jones to mark both Any and All as valid answers. Unfortunately the QOTD engine does not allow multiple "possible" answers.

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • SanDroid

    SSChampion

    Points: 10068

    QOTD reference says

    there can be any number of rows from ZERO to the number of rows in the table being deleted from.

    Which matches what I expected and what I saw when running the answer code.

    Why is "none of the above" not the right answer.

    I would like to see that explination.

    Even a good understanding of english as a first language does not help figure out this.

    Nice concept for a question, but seems the scoring in flawed.

    :Wow:

  • Rose Bud

    SSCrazy

    Points: 2946

    Interesting question. I had no problem with the semantics of the question or answer.

    Wondering if anyone can think of a real world example where one might want to use "ORDER BY NEWID()?" Just curious.

  • Jason Selburg

    SSC-Insane

    Points: 24560

    wware (4/25/2011)


    Interesting question. I had no problem with the semantics of the question or answer.

    Wondering if anyone can think of a real world example where one might want to use "ORDER BY NEWID()?" Just curious.

    It's a nifty way to randomize the order of a result set.

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • Ninja's_RGR'us

    SSC Guru

    Points: 294069

    wware (4/25/2011)


    Interesting question. I had no problem with the semantics of the question or answer.

    Wondering if anyone can think of a real world example where one might want to use "ORDER BY NEWID()?" Just curious.

    I did when doing reindexing during business hours. I wanted to make sure to not lock to same table over and over again so newid() on the final query made the cut... especially combined with waitfor delay

Viewing 15 posts - 1 through 15 (of 56 total)

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