Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2005

    Unanswered: Bug in SELECT TOP (100) PERCENT with ORDER BY in SQLExpress?

    I have a problem with the following query in SQLExpress:

    SELECT TOP (100) PERCENT ClientSurname, ClientName
    FROM dbo.Client
    ORDER BY ClientSurname, ClientName

    The query returns always assorted data ignoring the ORDER BY keyword, no matter if the query is invoked directly from Management Studio Express CTP as a View, Table-valued function or called from an Access ADP project. The result is always assorted.

    Now an interesting thing is that the syntax below returns always an expected order:

    SELECT TOP 10000

    Am I missing something or is it a bug in SQLExpress?

  2. #2
    Join Date
    Jun 2004
    I never use the brackets (parenthesis) around the percentage. Maybe your second example is just using the top 10000 (not the 99%) and sorting your recs as you expect.

    Keeping in mind that I know nothing of this SQLExpress
    The person who confesses ignorance shows it once; the person who conceals it shows it many times.

  3. #3
    Join Date
    Jul 2003
    San Antonio, TX
    TOP is a function, not a predicate as it used to be in 2K.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Posting Permissions

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