• It is a worst practice when it comes to production class code.

    But it sure is a power users tool and a shortcut for ad hoc queries. When I am working on a problem that requires me to run a bunch of SELECT statements, I am not going to type the column names in ORDER BY clause. I'll simply use ordinal numbers.

    Here's another reason why, we shouldn't use ordinal position in production code:

    SELECT id, name

    FROM sysobjects

    ORDER BY 1.2

    Notice the dot between 1 and 2. It's a typo, it should actually be a comma. But the statement still works, except that the output is not sorted as you'd expect, there by introducing a bug.

    And no, there are no performance differences.

    HTH,

    Vyas

    http://vyaskn.tripod.com/

    Edited by - vyaskn on 10/01/2002 07:03:08 AM


    HTH,
    Vyas
    SQL Server MVP
    http://vyaskn.tripod.com/