SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


GO


Author
Message
dmoldovan
dmoldovan
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1536 Visits: 1479
cfradenburg (6/7/2011)
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've got it. But "script" would have been more appropriate.
chrisfradenburg
chrisfradenburg
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2936 Visits: 2076
wware (6/7/2011)
[quote]cfradenburg (6/7/2011)
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?


Sorry, I was reading fast and made an assumption about what you were quoting. I can say on my SQL 2008R2 SP2 CTP box it didn't do that. It could be a bug that got fixed.
Kiara
Kiara
SSC Eights!
SSC Eights! (809 reputation)SSC Eights! (809 reputation)SSC Eights! (809 reputation)SSC Eights! (809 reputation)SSC Eights! (809 reputation)SSC Eights! (809 reputation)SSC Eights! (809 reputation)SSC Eights! (809 reputation)

Group: General Forum Members
Points: 809 Visits: 1426
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 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. You do NOT receive "50" as the result set to this query.


I ended up reading the question, reading the answers, deciding that I must be losing my mind, running the query to see what I was missing, re-reading the answers, and deciding that I had no idea how to translate the actual results into the list of possible answers.

So I'm not answering today's question unless we end up with a set of answers that actually matches the question.

-Ki
dmoldovan
dmoldovan
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1536 Visits: 1479
cfradenburg (6/7/2011)
wware (6/7/2011)
[quote]cfradenburg (6/7/2011)
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?


Sorry, I was reading fast and made an assumption about what you were quoting. I can say on my SQL 2008R2 SP2 CTP box it didn't do that. It could be a bug that got fixed.


I get an "incorrect syntax near 50" message when hovering on the text in SSMS. However the script works as expected. I work on SQL 2008 dev edition SP2
Ninja's_RGR'us
Ninja's_RGR'us
SSC Guru
SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)

Group: General Forum Members
Points: 66225 Visits: 9671
dmoldovan (6/7/2011)
cfradenburg (6/7/2011)
wware (6/7/2011)
[quote]cfradenburg (6/7/2011)
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?


Sorry, I was reading fast and made an assumption about what you were quoting. I can say on my SQL 2008R2 SP2 CTP box it didn't do that. It could be a bug that got fixed.


I get an "incorrect syntax near 50" message when hovering on the text in SSMS. However the script works as expected. I work on SQL 2008 dev edition SP2


Do you have red-gate's sql prompt? I have it throw errors like that in the past. It's not 100% accurate afaik (but I have an older version).
rsingh.sql
rsingh.sql
Old Hand
Old Hand (360 reputation)Old Hand (360 reputation)Old Hand (360 reputation)Old Hand (360 reputation)Old Hand (360 reputation)Old Hand (360 reputation)Old Hand (360 reputation)Old Hand (360 reputation)

Group: General Forum Members
Points: 360 Visits: 177
Correction:

Select count(*) from Test

will result into 50,
Toreador
Toreador
Hall of Fame
Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)

Group: General Forum Members
Points: 3814 Visits: 8123
Can anyone who's said it's confusing, explain how any answer other than '50' could possibly be right? To answer '50' needs an assumption that they meant 'count(*)' rather than '*'. What similarly simple assumption couild make any of the other options correct?
Richard Warr
Richard Warr
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3304 Visits: 1991
Sadly, people would rather have a moan than cut the question setter a little slack. We all know what he meant to write so why not use that knowledge to tick the correct answer and move on with a bit of grace and humanity?

_____________________________________________________________________
MCSA SQL Server 2012
Ninja's_RGR'us
Ninja's_RGR'us
SSC Guru
SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)

Group: General Forum Members
Points: 66225 Visits: 9671
Did you guys actually read the question recently??? It says count(*).
dmoldovan
dmoldovan
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1536 Visits: 1479
Ninja's_RGR'us (6/7/2011)
Did you guys actually read the question recently??? It says count(*).


A few hours ago it was "SELECT * FROM Test"
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search