If a statement returns a result set with more than one record having the same values for its ‘Order By
’ clause, ASE and MS SQL Server will probably return the records in a different order.
Example
create table Test (i int, j int, c char(1500) default '')
insert into Test (i, j) values (1, 1)
insert into Test (i, j) values (1, 2)
insert into Test (i, j) values (1, 3)
insert into Test (i, j) values (2, 1)
insert into Test (i, j) values (2, 2)
insert into Test (i, j) values (2, 3)
insert into Test (i, j) values (3, 1)
insert into Test (i, j) values (3, 2)
insert into Test (i, j) values (3, 3)
insert into Test (i, j) values (4, 1)
insert into Test (i, j) values (4, 2)
insert into Test (i, j) values (4, 3)
select * from Test order by j
drop table Test
Note: Theoretically, as long as the ‘Order By
’ order is observed, both systems even might return the result set in a different order if the query is executed a number of times.