[dba-SQLServer] sorting problem

Michael Maddison mmaddison at optusnet.com.au
Sat Oct 30 07:24:07 CDT 2004


I don't have BOL at home but I think if the table has a clustered index then
that is how it is returned without an order by.  IIRC you can guarentee it.
A heap is a different story as the actual table has no order.

regards

Michael M


Hi Mark:

I am using SQL Query Analyzer to view the sorted column.  Usually I get the
db to sort the results before handing it over to the application program
because the db can do a much better job on sorting than the application (in
99.99999% of the case).  However, the application program is superior to the
db in terms of presenting the data; if that is what you are getting at, then
I see your point but it would not exactly suit the current need.

Someone correct me if I am wrong but if I view any column of a table from EM
without explicitly sorting it (ie. the ORDER BY clause), there is no solid
guarantee that the records will be displayed in the same order the next time
the table is queried again.

Billy

>From: Mark Rider <ridermark at gmail.com>
>
>What are you using to view the sorted column? That will be the best
>thing to use to figure out the sort.  Pull the data from the column,
>and have the program sort it as you want.If you are looking at the
>column in EM then it will sort according to how the database sees it,
>and that is the way the text will be sorted.
>
>--
>Mark Rider
>http://commonsensesecurity.info
>_______________________________________________
>dba-SQLServer mailing list
>dba-SQLServer at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
>http://www.databaseadvisors.com
>


_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.718 / Virus Database: 474 - Release Date: 9/07/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.718 / Virus Database: 474 - Release Date: 9/07/2004




More information about the dba-SQLServer mailing list