Can I count on Tables being sorted by the order of records inserted?

M

Marvin Cohen

If I insert records into a table in a certain order with a set of
"insert" statements, can I count on a sql statement such as "select *
from mytable" to always return those records in that order (assuming I
don't have a ORDER BY clause)?
Thanks,
Marvin
 
T

TC

Tables will often *seem* to be sorted. That is, the records will *seem* to
be in some obvious order. This is for various reasons, none of which are
reliable. As the other respondent said, you must assume that each table is
randomly ordered, despite what you may see on the screen.

HTH,
TC
 
M

Michael Wong

So... What can be the best solution for this kind of problem? Add a
time&sequential number field, like a GUID?
 
T

TC

So... What can be the best solution for this kind of problem? Add a
time&sequential number field, like a GUID?

There is no "problem"! Tables do not have an order. To get the data out from
a table "in order", you must use a query with an ORDER BY clause, or a form
with the OrderBy[On] properties set.

TC
 
T

TC

Further to this, if you are still reading, I guess we haven't really
answered your original question!

If you need to access table records in the order they were data-entered,
just define an autonumber field for that table, then access the table
through the following query:

SELECT * FROM YourTable ORDER BY TheAutoNumberField

HTH,
TC


TC said:
So... What can be the best solution for this kind of problem? Add a
time&sequential number field, like a GUID?

There is no "problem"! Tables do not have an order. To get the data out from
a table "in order", you must use a query with an ORDER BY clause, or a form
with the OrderBy[On] properties set.

TC

*seem*
table
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top