I need to select a table sorted as a "Queue", the least recent to most recent row. Exists something feature that enable me to do this?
+1
A:
You need at least a column that represent a moment in time, like a date column. Then you order by that field:
SELECT * FROM Employee ORDER BY BirthDate
Pierre-Alain Vigeant
2010-01-19 18:24:41
+3
A:
At the very least, if you have an IDENTITY/AUTONUMBER, or at least a DATE to sort by you could
SELECT *
FORM Table
ORDER BY DateColumn
Or
SELECT *
FORM Table
ORDER BY IDColumn
astander
2010-01-19 18:25:24
Just keep in mind that there is no guarantee that IDENTITY columns will be in sequential order of the time at which they were inserted
Tom H.
2010-01-19 18:31:29
Aggreed, but with no structure provided, this should cover some of th OP's possibilities.
astander
2010-01-19 18:36:36
A:
If you don't mean "ORDER BY", do you mean use a table as concurrency-safe message queue?
Like this: SQL Server Process Queue Race Condition?
gbn
2010-01-19 18:32:06