I have a complicated situation. There is a parent database P
and then there is another database C
which I am told is same as P
(both SQL Server 2012). They both are on different server. I am doing a select * from tableA
on both P
and C
. The data retrieved is exactly the same, but in different order. Both the tables have the same metadata. What could be the possible cause?
EDIT 1
The thing is, I have a stored procedure which I have got from my client and it runs on P
, which is then used in a SSRS report. I dont have the permission to access P
or the report. I am running the same stored procedure on C
. That is when I get the same rows but in different order. No other order by
clause has been added in the store procedure running C
, apart from the ones already present. If the databases are same with same data and the table structure is also the same, why would the rows appear in different order?
EDIT 2
tableA
COL1 COL2 COL3 COL4
---------- ---------- ---------- ----------
100 C 1 2015-01-01
101 A 2 2015-01-05
102 A 2 2014-01-01
103 B 4 2011-09-01
104 C 1 2015-01-01
If in the above tableA
(COL1
is the PRIMARY KEY
), I do a select * from tableA order by COL2, COL3, COL4
, then :
The result in P
COL1 COL2 COL3 COL4
---------- ---------- ---------- ----------
102 A 2 2014-01-01
101 A 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 A 2 2014-01-01
101 A 2 2015-01-05
103 B 4 2011-09-01
104 C 1 2015-01-01
100 C 1 2015-01-01
This is the issue.
PS - There is a change in collation of the DBs