To elaborate on what Jon said, Sql Server tables are sets. Yes, they
are visualized with an "order", but that visualization is implying something
that is not the case. When you insert rows into SQL Server, there is no
order to how they appear in the table. Yes, there is a physical
implementation of how the rows are stored, and there is an order to that,
but that order is not guaranteed.
This is why Jon's recommendation works, and you will have to do this
every time you query the data. You have to apply the sort that makes sense
to your application.
As a general recommendation, when working with data in SQL Server, don't
think of it in terms of tables (which have an implicit order from top to
bottom, and which also imply thinking in terms of cursors, which have an
order of traversal). Rather, you have to think about it in terms of set
operations.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:11**********************@y80g2000hsf.googlegr oups.com...
On Apr 4, 7:33 am, "Shum" <shumy...@gmail.comwrote:
>Hi .. another quey... i just noticed that the entries being done to
the sql server tables ( insert query in C# )are not in the correct
order.. the last entry is not always the last record in the table..
How to overcome it? i want all the records in the order of insertion...
If you want a particular order, you should have a column in your table
which you sort by, and make sure that you insert entries with
appropriate values for that column.
Jon