inserting record into table adds to top of table

  • Tables, by definition, have no order.

    If you care about the order of the data, you need to include an ORDER BY clause in any queries you run.

  • Thanks your correct I was able to resolve this issue by creating a new table and updating with the one I am inserting records to and ordering it appropriately.

    Appreciate the response.

  • Tables, by definition, don't have an order. Position of rows within a table is a meaningless concept. The way the rows are stored physically on disk (which is what you affected) has no impact on the order that the rows will be returned. If you do a straight select * from table, you may get the rows back ordered as they are on disk, or you may not.

    If the order is important, put an order by on the queries that select from the table. That's the only time and the only way you can affect order.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 3 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply