sql server - order by original record order
Posted on 2009-02-11
I'm working with an application that loads a dynamic homepage for each client that uses it. The homepage is set up from a database table that holds all the controls that are to be loaded into the homepage for each client. The order of the records in the table is important as they are loaded into the homepage in the order in which they appear in the table. There is however no column in the table that specifies the order in which the records are to be listed. It seems to be working off the assumption that the order in which the records are inserted is the correct order and that they will stay in that order.
The problem that I'm running into is that i'm needing to join this table with another table and conserve the loading order. This is not happening however when I do the join. I get the correct data back but there doesn't seem to be any logical order conserved from the way the records were listed in the table originally. And as there is no identity column, there is no way to fix this by doing an order by.
Additionally, I'm not able to add such a column because it would create problems in other places in the applicaiton.
Is there a way to detect the original order of records in a table and order by that?