sql - Changed order of rows from same table -
i have complicated situation. there parent database p
, there database c
told same p
(both sql server 2012). both on different server. doing select * tablea
on both p
, c
. data retrieved same, in different order. both tables have same metadata. possible cause?
edit 1
the thing is, have stored procedure have got client , runs on p
, used in ssrs report. dont have permission access p
or report. running same stored procedure on c
. when same rows in different order. no other order by
clause has been added in store procedure running c
, apart ones present. if databases same same data , table structure same, why rows appear in different order?
edit 2
tablea col1 col2 col3 col4 ---------- ---------- ---------- ---------- 100 c 1 2015-01-01 101 2 2015-01-05 102 2 2014-01-01 103 b 4 2011-09-01 104 c 1 2015-01-01
if in above tablea
(col1
primary key
), select * tablea order col2, col3, col4
, :
the result in p
col1 col2 col3 col4 ---------- ---------- ---------- ---------- 102 2 2014-01-01 101 2 2015-01-05 103 b 4 2011-09-01 100 c 1 2015-01-01 104 c 1 2015-01-01
the result in c
col1 col2 col3 col4 ---------- ---------- ---------- ---------- 102 2 2014-01-01 101 2 2015-01-05 103 b 4 2011-09-01 104 c 1 2015-01-01 100 c 1 2015-01-01
this issue.
ps - there change in collation of dbs
even though both table has same metadata; per post can seen not using order by
clause query , without order by
; order of returned result can never guaranteed.
even if run query in same server multiple times, may observe different order of data coming in resultant output.
to make sure, getting specific order use order clause
along query
select * tablea order some_column
Comments
Post a Comment