Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2014

    Unanswered: Read Table by index

    hi , can you help me with a simple sql? I need to read a db Table but sorted by index - is there a generic "select * from tableA sorted by index" where it just uses whatever index it finds (main index) or do i have to name the index?

  2. #2
    Join Date
    Jan 2007
    Provided Answers: 12
    You cannot guarantee the order of a resultset without specifying an ORDER BY clause.

    You could achieve this by abusing dynamic SQL but I wouldn't recommend it.

    More importantly, why are you trying to do this?
    Home | Blog

  3. #3
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    Microsoft SQL Server and the ISO/ANSI standard support the ORDER BY clause. The ORDER BY clause doesn't guarantee use of an index, but if there is a covering index then it will almost certainly be used.

    Most SQL dialects have a non-standard way to specify the use of an index, but the exact syntax and the options provided varies from one dialect to another.

    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

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