Groups | Blog | Home
all groups > sql server programming > september 2003 >

sql server programming : Default Select command ordering


michael_baker NO[at]SPAM advantexmail.net
9/23/2003 11:41:57 PM
I am trying to programically recover from a SQL 2000 critical error
while using cursors to traverse a recordset returned by a select
statement. I believe the select statement by default simply returns
what is in my table from top to bottom (as I have no order clause in
my statement). During my traverse of the cursor I perform a delete
from table once I am done processing the record. So in a sense I am
"popping" records off the table like an array. So with this said,
let's say a critical error occurs during the processing of one of
these records. If I run the same select statement as I did before
would the record that failed with this critical status be the first
record in the table? Is this correct logic?

Thanks,
Narayana Vyas Kondreddi
9/24/2003 7:50:43 AM
Ordering is not guaranteed if you don't specify ORDER BY. So, if your
application logic relies on a specific order, use ORDER BY explicitly.

--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
What hardware is your SQL Server running on?
http://vyaskn.tripod.com/poll.htm




[quoted text, click to view]
I am trying to programically recover from a SQL 2000 critical error
while using cursors to traverse a recordset returned by a select
statement. I believe the select statement by default simply returns
what is in my table from top to bottom (as I have no order clause in
my statement). During my traverse of the cursor I perform a delete
from table once I am done processing the record. So in a sense I am
"popping" records off the table like an array. So with this said,
let's say a critical error occurs during the processing of one of
these records. If I run the same select statement as I did before
would the record that failed with this critical status be the first
record in the table? Is this correct logic?

Thanks,
Michael

AddThis Social Bookmark Button