不指定order by或者不利用索引顺序, 不管sql2000还是2005,select语句得到的结果集顺序都是不能保证的。
在这一点上,二者没有区别。而你的,你说不一样,因为两个表自身的情况都不一样。

解决方案 »

  1.   

    不加 order by 时, 记录顺序是未知的, 跟取数据的顺序相关
    而取数据的顺序依赖于执行计划所以你比较一下执行计划, 如果执行计划不一样, 顺序肯定不一样.
      

  2.   

    to fcuandy,想请教下
    这样的顺序是不是根据语句查询出来的结果顺序而定的呢?受影响于数据获取时候的查询方法还是数据的实际存储顺序?还是对查询语句进行匹配而产生的结果集数据的顺序呢?
      

  3.   

    这个问题说明以下规则的必要性:
       不要期望没有order by的语句的次序,如果期望记录次序,必须指定order by没有order by的语句,特别是涉及多表的语句,不单单2000和2005次序可能不同,同一版本的不同补丁也会不同
      

  4.   


    不管sqlserver哪个版本,都是默认是按照表的主键升序排列!你检查看下2张表的主键吧!
      

  5.   

    不加order by时,读出来的顺序应该是硬盘上的顺序。或是聚集索引的顺序
      

  6.   

    http://en.wikipedia.org/wiki/Order_byOrder by (SQL)
    From Wikipedia, the free encyclopedia
      (Redirected from Order by)
    Jump to: navigation, searchAn ORDER BY clause in SQL specifies that a SQL SELECT statement returns a result set with the rows being sorted by the values of one or more columns. The sort criteria do not have to be included in the result set. The sort criteria can be expressions, including - but not limited to - column names, user-defined functions, arithmetic operations, or CASE expressions. The expressions are evaluated and the results are used for the sorting, i.e. the values stored in the column or the results of the function call.ORDER BY is the only way to sort the rows in the result set. Without this clause, the relational database system may return the rows in any order. If an ordering is required, the ORDER BY must be provided in the SELECT statement sent by the application. Although some database systems allow the specification of an ORDER BY clause in subselects or view definitions, the presence there has no effect. A view is a logical relational table, and the relational model mandates that a table is a set of rows, implying no sort order whatsoever. The only exception are constructs like ORDER BY ORDER OF ... (not standardized in SQL:2003) which allow the propagation of sort criteria through nested subselects.The SQL standard's core functionality does not explicitly define a default sort order for Nulls. With the SQL:2003 extension T611, "Elementary OLAP operations", nulls can be sorted before or after all data values by using the NULLS FIRST or NULLS LAST clauses of the ORDER BY list, respectively. Not all DBMS vendors implement this functionality, however. Vendors who do not implement this functionality may specify different treatments for Null sorting in the DBMS.[1] ExamplesSELECT * FROM Employees 
    ORDER BY LastName, FirstName
      

  7.   

    。。不是这样子的
    view 同表一个性质 他本身无任何排序是根据物理访问的先后顺序来排序的。
    就如同表一样。
    2000里面view 能根据 order by 来排序是个bug
    2005 已经纠正找个bug 以后的版本也没这个bug
    >=2005的版本 根据 建立view 时候根据物理访问的先后顺序来排序
    view 同 table 本身无任何人为的排序可言。请参考 ansisql 1999或者 inside tsql 系列第二册 程序设计 view 视图着一章节。
    没想到好多大牛。。回答错误。。
      

  8.   

    。。不是这样子的
    view 同表一个性质 他本身无任何排序是根据物理访问的先后顺序来排序的。
    就如同表一样。
    2000里面view 能根据 order by 来排序是个bug
    2005 已经纠正找个bug 以后的版本也没这个bug
    >=2005的版本 根据 建立view 时候根据物理访问的先后顺序来排序
    view 同 table 本身无任何人为的排序可言。请参考 ansisql 1999或者 inside tsql 系列第二册 程序设计 view 视图着一章节。
    没想到好多大牛。。回答错误。。
      

  9.   

    。。不是这样子的
    view 同表一个性质 他本身无任何排序是根据物理访问的先后顺序来排序的。
    就如同表一样。
    2000里面view 能根据 order by 来排序是个bug
    2005 已经纠正找个bug 以后的版本也没这个bug
    >=2005的版本 根据 建立view 时候根据物理访问的先后顺序来排序
    view 同 table 本身无任何人为的排序可言。请参考 ansisql 1999或者 inside tsql 系列第二册 程序设计 view 视图着一章节。
    没想到好多大牛。。回答错误。。