Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Location
    KL, Malaysia
    Posts
    38

    Lightbulb Unanswered: Select top 100 and select top 1000

    Hi all,

    Just a quick one. I noticed that if I order a column (xyz) which have all values that are same, when I issue a select top command:

    statement A: Select top 100 * from table a order by xyz

    and

    statement B: Select top 1000 * from table a order by xyz

    Some might expect results in statement A should be a subset of statement B. However, this is NOT always the case.

    ordering a column that has all values which are the same is indeed stupid, but out of curiosity, I would like to know what optimization techniques sql 2000 to come out with the above results.
    Save the dugongs!

  2. #2
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    Use Query analyzer and see the query execution plan to optimize the query.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •