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
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: 2 days ago @ 1:55 AM
Points: 11, Visits: 477
Comments posted to this topic are about the item SELECT TOP
Post #1037478
Posted Monday, December 20, 2010 11:16 PM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Today @ 1:41 PM
Points: 17,940, Visits: 15,924
Thanks for the question.



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


SQL RNNR

Posting Performance Based Questions - Gail Shaw
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 @ 5:13 AM
Points: 1,131, Visits: 1,394
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


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 5:53 AM
Points: 4,098, Visits: 5,447
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 @ 1:52 PM
Points: 13,511, Visits: 11,299
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 @ 6:05 AM
Points: 2,586, Visits: 2,442
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, October 24, 2014 5:46 AM
Points: 1,416, Visits: 804
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 @ 8:18 AM
Points: 1,620, Visits: 5,694
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: 2 days ago @ 2:15 AM
Points: 1,110, Visits: 4,907
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