Microsoft SQL 2012 Stored Procedure returning records in a different order every time it is executed
Posted on 2014-10-10
We recently upgraded to Microsoft SQL 2012, and are now experiencing some issues with the Query results.
Each time we call a stored procedure it returns the results in a different order.
First time we call the stored procedure it will return:
Second time we call the stored procedure it will return:
Another strange thing is, we have a live database and a test database. I was testing a stored procedure on the live database, and it returned all records in the correct order every time, but the same stored procedure on the test database returned the results in a different order. Please note, I'm not sure why this specific stored procedure is returning the correct results in the correct order on the live database, because there are other stored procedures on the live database that are returning records in different order each time its executed.
I'm not sure why this is happening, It never happened on Microsoft SQL 2008. The project is huge so before making changes to the queries I came here to seek advice.