GO

  • I agree with WayneS.

    And I have one more question - why do you ask about "the output of this batch"? As far as I can see there are 3 batches, separated by "GO". Am I missing something?

  • honza.mf (6/7/2011)


    DugyC (6/7/2011)


    honza.mf (6/7/2011)


    WayneS (6/6/2011)


    Actually, none of those choices are correct. You get back 50 random GUID values.

    1. NEWID() returns a random GUID (aka uniqueidentifier)

    2. Select statement has no order by clause, so the results are random.

    3. The GO 50 repeats that batch (since the last GO statement) 50 times (if in SSMS and the batch separator is set to "GO")

    The answer annotated as correct ("50") is not correct... the results are 50 random GUID values. "50" is not returned. Now, if it was a select count(*), that would be different.

    Is it so hard to add the missing count? Be empathic a little :w00t:

    The "correct" answer is least non-correct.

    I concur with Wayne, I eliminated your "least non-correct" answers as I knew, had the batch worked, it would return a list of guids... therefore I went for an error condition and got it wrong.

    Normally I would agree with you regarding being "picky", but here the ambiguity was too deep.

    The list of GUIDs was not in the list of possible answers.

    If you don't like to add count to the last query, just imagine some words like "GUIDs", "lines", or "items" after the numeric possibilities. And the answer is almost correct.

    Other idea: Try to write your own QotD (I did) and make it bulletproof (first time I was far away of that).

    Yeesh! Somethings got your cage rattled 😛

    I think I've made it perfectly clear that I'm on your side as much as I agree with Wayne... and I never slated the original post or the question, just explaining my confusion. That is all.

    Chill pill 😀

    _____________________________________________________________________
    [font="Comic Sans MS"]"The difficult tasks we do immediately, the impossible takes a little longer"[/font]

  • Just adding my two cents.

    .02

    GO

    or maybe

    GO .02

  • I ran this on a 2005 box and got an insert error

    Insert Error: Column name or number of supplied values does not match table definition.

    ** An error was encountered during execution of batch. Continuing.

    Why was my result different from others

  • Never Mind, I had another table test in the db, nice.

  • Too easy, and quite the déjà-vu...

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • None of the answers are correct. You receive a result set with 50 GUIDS. Very poor question. No QA before posting.

  • The question was OK the answers are the issue. I agree that the 50 is incorrect (that is what I selected) but it is the least incorrect.

  • dmoldovan (6/7/2011)


    And I have one more question - why do you ask about "the output of this batch"? As far as I can see there are 3 batches, separated by "GO". Am I missing something?

    Technically it is three different batches but based on context it's really easy to get that the author was referring to the set of three batches as one large batch. Now, I'm sure someone is going to say that using "batch" in this way is complete unacceptable but I don't see anything really wrong with it.

  • I also agree with Wayne. None of the answers were correct.


    Regards,

    Carla Hepker
    Documentation: A Shaft of light into a coded world.

  • Iggy-SQL (6/7/2011)


    I got it right, but I just wonder, if GO is meant to take an optional [count], why does it has the red squiggly underline mark when writing it in SSMS as a query, stating that there's an Incorrect syntax near '50'.?

    I fear this question got lost in the hubbub about the obvious mismatch of the question/answers. I would also appreciate some insight into this. Thanks.

  • wware (6/7/2011)


    I fear this question got lost in the hubbub about the obvious mismatch of the question/answers. I would also appreciate some insight into this. Thanks.

    Funny how dozens of people posting the same thing does that, isn't it? I responded to this a few minutes ago so see my last post.

  • forsqlserver (6/7/2011)


    I am getting output:

    7B6A0544-E2A0-4984-921E-BE50EED041C7

    8BF68496-1DC4-4C47-850E-7000FAA8FF23

    D0662128-5ED0-4002-ADED-149176F78CF0

    C031E61D-F269-4396-B435-B4C0A27A0E2B

    0062D0A0-9D78-49AB-92FB-74C6E3897E4A

    3B140F69-EC2C-4408-B964-05191269CC7F

    ...

    Yup....

    and I get

    57D19CCA-E5EC-4113-9C21-B7D557153D8A

    3BF757D0-9CE3-47FA-8B24-7819CAEE4772

    D6DD8650-355C-47DD-B0EC-B73D71F2CCD4

    F1C256C0-1315-4618-BFFB-D878F71D4B08

    DDEA508A-79FA-4E69-ABDD-39C4AE6C65C6

    B64E95E7-B1CE-465D-91D5-534D1139C1BE

    1F517EBD-3507-4789-BAC0-7CD0F907D424

    FEC71A44-7F5A-4563-823B-110E7736F1DE

    D285394C-3E8A-4FEE-B6D4-E73885808AD6

    8A9F1516-32BC-465C-B586-CD8A52ED0E02

    13440CC2-9B39-46B4-916E-C4FEC34FD944

    ED4ABEF3-5C79-45A2-AF74-B1DFF4961047

    19BB1EF9-6D19-4544-AAA1-2D7B7F507E30

    B214E5A6-1B71-4C25-8AFE-DC39EB81F1D8

    B8DE2D3C-3A65-4BE1-A51A-4E2D1120E8D3

    B6CB1FE7-0EF3-44CA-A4CD-0DB491544E32

    1362F656-BE8D-4935-9CED-2EBD86158B15

    5AC7C5AE-E84C-4AC4-90A7-6C74749F011B

    EACB4288-8285-4E50-8802-BAF4D5710AD7

    0A1BB3F8-4AD2-4F75-A62A-11789C2F9DC0

    65B3D555-7820-4AF2-BE5A-5643FDA6147A

    199A7B68-71F3-481F-B61E-E1E1FCE52CB1

    9BDDAFA1-73E8-47F1-976F-79C1F690C403

    F88D4438-DD13-4E8D-9166-6B92AF67D2DE

    D6A4505E-A5F7-4700-B59B-A8575BFA76C9

    9815A0DE-3A30-4ABB-A8A4-116E66551C3C

    DC72501F-2462-4F91-B1B1-1B2576CBEECE

    17860D7F-986C-4D5C-9FAA-F53CECF2E5EC

    212345A2-2C8C-4257-A7C1-241A37B5F4A8

    8104DB58-C04A-4B66-AE42-03C20A423ABE

    FF2A93D8-E7E5-4C30-AB5D-A858AEAE29C7

    C81C60BE-9625-4CBE-AB30-936A9B98E633

    A4171D1F-FD3B-4E20-991A-9B572BBF1A31

    2976821B-36D3-4A2C-A3E3-8D8BF78BE6E0

    E63D93D0-F18C-4FBF-B5DB-5D141E9A61E3

    C7F0B6C6-F71B-4B70-A0E5-29FE405BC684

    3C9A6FB3-C6E1-43CA-8F08-32CAD9952B43

    67D5FEC0-37A8-4F97-AE1A-C4A414714E99

    850814F5-A85D-4EA0-B5FB-793C8A356C6E

    7EBBD950-9B79-4184-B16F-8C08BF02CF6C

    B7219EED-0ABA-4304-9CA9-CAAD36814FA4

    4C2A3947-D101-4889-AB63-840218575446

    B7A85EC7-1B2A-4E3C-BD20-682405E38369

    EE277A7D-B821-4D82-80AA-172161348D92

    58B3BA94-28A1-4FC6-8E91-238A5A65394E

    621C2183-8C81-4B29-8EF5-B56AF14B6551

    67BA4D34-F111-4605-BD62-2BFC4E6955C9

    75FD300A-863D-4878-BDBC-8F27DBAB7032

    CF9B2B6D-39C6-40AD-84D0-C00682A01125

    45AE83DC-2C34-4BE1-B4E4-C1DE44ABEDA7

    It was obvious the question was written incorrectly and needed to have count(*) instead of * or one of the answers should have been 50 random GUIDs. But neither was the case, which left me guessing if he meant a count(*) or 1 or 0 might represent to him either 1 for a true/correct value or 0 for the number of errors returned.

    I went with 50... but it was a hard guess as I'm just not a good mind reader.



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • /my 2¢ on

    Seems that the author was trying to point out the optional argument of a positive integer for the GO batch terminator. Unfortunately in their haste to find a way to ask a question about it they created a good question with a poor list of response options. Everyone has been so hung up on the answers that they forgot about the question and more importantly the concept that the author was trying to convey.

    /my 2¢ off

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • cfradenburg (6/7/2011)


    wware (6/7/2011)


    I fear this question got lost in the hubbub about the obvious mismatch of the question/answers. I would also appreciate some insight into this. Thanks.

    Funny how dozens of people posting the same thing does that, isn't it? I responded to this a few minutes ago so see my last post.

    I see your post regarding 1 batch vs. 3 batches, but I don't see an answer about why SSMS suggests a syntax problem with the "50" by giving it a red squiggly underline. Am I missing something?

Viewing 15 posts - 16 through 30 (of 54 total)

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