Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««23456»»»

GO Expand / Collapse
Author
Message
Posted Tuesday, June 7, 2011 7:50 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, September 9, 2014 1:28 AM
Points: 363, Visits: 1,320
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.
Post #1121022
Posted Tuesday, June 7, 2011 7:55 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, August 4, 2014 8:10 AM
Points: 1,635, Visits: 1,972
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.
Post #1121023
Posted Tuesday, June 7, 2011 8:04 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Thursday, June 19, 2014 8:00 AM
Points: 592, Visits: 1,425
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
Post #1121031
Posted Tuesday, June 7, 2011 8:04 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, September 9, 2014 1:28 AM
Points: 363, Visits: 1,320
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
Post #1121032
Posted Tuesday, June 7, 2011 8:10 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Friday, September 12, 2014 10:44 AM
Points: 21,405, Visits: 9,617
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).
Post #1121037
Posted Tuesday, June 7, 2011 8:19 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, May 27, 2014 2:18 PM
Points: 248, Visits: 172
Correction:

Select count(*) from Test

will result into 50,
Post #1121049
Posted Tuesday, June 7, 2011 8:30 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, August 29, 2014 10:20 AM
Points: 1,740, Visits: 6,366
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?
Post #1121059
Posted Tuesday, June 7, 2011 8:33 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 2:15 AM
Points: 2,141, Visits: 1,734
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?
Post #1121061
Posted Tuesday, June 7, 2011 8:34 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Friday, September 12, 2014 10:44 AM
Points: 21,405, Visits: 9,617
Did you guys actually read the question recently??? It says count(*).
Post #1121062
Posted Tuesday, June 7, 2011 8:36 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, September 9, 2014 1:28 AM
Points: 363, Visits: 1,320
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"
Post #1121064
« Prev Topic | Next Topic »

Add to briefcase «««23456»»»

Permissions Expand / Collapse