• A database is not like an excel spreadsheet; the data is not stored, nor returned in any specific order .

    if you want the data in order, you MUSt supply an ORDER BY SomeColumn clause as part of your query

    You have to understand that the databases first purpose is to return the data in the fastest way possible.

    so depending on the indexes, where the data is stored, whether the query was executed in parallel and the streams of data are merged, statistics, fragmentation, and many other items all affect the order the data *might* get returned in without an ORDER BY Clasue.

    SQL will return the data however it deemed to get the data the fastest...and fastest in not always the same order the data was inserted.

    my signature has a smart rule to remember.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!