Every time an SQL query is run without the ORDER BY clause, the sort order of the results returned is not guaranteed.

SQL Server decides which is the best order to return the query. This is based on factors like whether indexes are used or data fragmentation on the physical drive because SQL Server will attempt to return the result in the most efficient way.

If you run the same query a few times in the same environment, you may find that the sort order remains the same. It does not mean the sort order is guaranteed but that SQL Server went through processing the data in the same way.

The same query may not retrieve the result in the same order if indexes have been rebuilt or the database is on another server or many other factors.

Just a point to note.

One Reply to “SQL Query Result Order”

  1. hola mi mujer esta de 22.6 semanas y el peso del bebe (varon!!!!!!!!!) dio 512 gramos y dijo que viene pesado!!!! esperemos que no crezca mucho porque mi porbre mujer mide 1.60!!!

Leave a Reply to Just Share Cancel reply

Your email address will not be published.