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 12345»»»

SELECT TOP Expand / Collapse
Author
Message
Posted Monday, December 20, 2010 9:04 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Today @ 5:20 AM
Points: 9, Visits: 437
Comments posted to this topic are about the item SELECT TOP
Post #1037478
Posted Monday, December 20, 2010 11:16 PM


SSC-Insane

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

Group: General Forum Members
Last Login: Today @ 10:59 AM
Points: 21,619, Visits: 15,275
Thanks for the question.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1037505
Posted Monday, December 20, 2010 11:23 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 7:29 AM
Points: 1,091, Visits: 1,350
Nice question.
MSDN link for the same: http://msdn.microsoft.com/en-us/library/ms188385(v=SQL.105).aspx


Thanks
Post #1037508
Posted Monday, December 20, 2010 11:47 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 3:55 PM
Points: 3,902, Visits: 5,076
Good "Back to basics" question.
thanks


____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Post #1037517
Posted Tuesday, December 21, 2010 12:34 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 7:45 AM
Points: 13,538, Visits: 10,412
I'm confused: the correct answer is the row that is returned "most of the time"?
If yes, then it isn't a good question, as other answers might be possible. If you can receive other rows with TOP 1, then you should have added an 'It depends' answer.

For the rest: nice question (also good layout and structure of code)




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1037541
Posted Tuesday, December 21, 2010 1:01 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 3:16 AM
Points: 2,494, Visits: 2,375
da-zero (12/21/2010)
I'm confused: the correct answer is the row that is returned "most of the time"?
If yes, then it isn't a good question, as other answers might be possible. If you can receive other rows with TOP 1, then you should have added an 'It depends' answer.

For the rest: nice question (also good layout and structure of code)

I agree with you: no "order by", no default sequence.

But what does this mean?
Always use the top with an ORDER BY clause!

Syntax should be appropriate to the hints.
Post #1037548
Posted Tuesday, December 21, 2010 2:20 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, July 4, 2014 9:03 AM
Points: 1,415, Visits: 796
Nice question and layout, but surely the answer should be 'cannot be determined' without the 'order by' clause.
Post #1037571
Posted Tuesday, December 21, 2010 2:50 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, January 24, 2013 9:59 PM
Points: 1,354, Visits: 1,299
I didn't like this question. I did get it right because I figured it would return 'Ann' most of the time but as the author said, it cannot be guaranteed without an order by clause. There should have been an option that said "Unknown" or "Cannot be 100% certain".
Post #1037588
Posted Tuesday, December 21, 2010 3:20 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 9:54 AM
Points: 1,626, Visits: 5,557
I was expecting the answer to be something along the lines of things are always returned in the clustered index order (which would obviously raise questions in any case), but then it's talking about it being indeterminate--if that's the case, why isn't there an "it depends" answer? Question implies one thing, answer says another!
Post #1037601
Posted Tuesday, December 21, 2010 5:03 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, July 24, 2014 4:28 AM
Points: 1,100, Visits: 4,898
Definitely should be "it depends"... I think the question is trying to show what happens when you add a clustered index to a heap and how the data is likely to get re-organised as the index is built.
Post #1037626
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse