Re: Order of records in a table? Db corrupt?



Yes, in general you are wrong (sorry), allthough this may vary from engine
to engine.

If you don't include an ORDER BY statement, your resultset is NOT ordered.
Any ordering you seem to see, should be considered random.

hope this helps,
Maurice


"Jacob Havkrog" <a@xxx> wrote in message
news:4540c1bc@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi.

I've got an Access table with autonumber primary key. I connect to the
table from my Delphi 5 application using TAdoConnection and TAdoTable.

When I do

MyTable.First;
while not MyTable.Eof do begin
...
MyTable.Next
end;


I expect to read the record ordered by the primary key. This has also been
the case for a long time.

But suddenly with one table, the records are not sorted properly. I have
tried to repair the database, but it doesn't help.

Am I wrong i expecting, that reading records like above, is equivalent to
reading them like this:

SELECT * FROM mytable ORDER BY myprimarykey

Is the database corrupt?

Thanks for any help!

Jacob






.



Relevant Pages

  • Order of records in a table? Db corrupt?
    ... from my Delphi 5 application using TAdoConnection and TAdoTable. ... I expect to read the record ordered by the primary key. ... Am I wrong i expecting, that reading records like above, is equivalent to ... Is the database corrupt? ...
    (borland.public.delphi.database.ado)
  • Re: removing last chrs (with different browsers giving different last chrs )
    ... I normally stick to regexp even if is_numericor type casting would also suffice, since the regexp engine is needed anyway, and I've set up a collection of frequently needed expressions as class constants. ... could very well be a primary key. ... In this case foreign key integrity would be violated (after all we are using a "real" relational database engine, ... A detailled error message is precisely the wrong thing in this case - it won't help the user, the developer has his or her own sources, but the evil bot will feast on that. ...
    (comp.lang.php)
  • Re: removing last chrs (with different browsers giving different last chrs )
    ... I normally stick to regexp even if is_numericor type casting would also suffice, since the regexp engine is needed anyway, and I've set up a collection of frequently needed expressions as class constants. ... could very well be a primary key. ... In this case foreign key integrity would be violated (after all we are using a "real" relational database engine, ...
    (comp.lang.php)
  • Re: SqlServerCe foreign key problem
    ... VolumeId and FieldId are identity columns and so are auto generated by ... Just for display purpose, all rows that are not sent to engine, but are ... CONSTRAINT PK_Volume PRIMARY KEY, Label nvarchar)"; ...
    (microsoft.public.sqlserver.ce)
  • Re: SqlServerCe foreign key problem
    ... VolumeId and FieldId are identity columns and so are auto generated by ... Just for display purpose, all rows that are not sent to engine, but are ... CONSTRAINT PK_Volume PRIMARY KEY, Label nvarchar)"; ...
    (microsoft.public.sqlserver.ce)