I am currently working on SQL server up-gradation project from SQL2014(compatibility - 100) to SQL2017(compatibility - 140). Here is one of the challenges i face with respect to behavioural changes b/w the older and newer versions of the DB.
Scenario#1:
- Insert records into temp table with specific order
select * into #temp from tblRefUserTypesTest order by UserTypeCode
- Select and view the records inserted in temp table,
select * from #temp
While running this query in 2014, we see that the records are retrieved the same way as they are inserted,ie, in the ascending order of UserTypeCode. But in 2017, it is not so. Though I use 'order by' while inserting the records in the temp table, the select statement does not throw the results as expected, until and unless we use'order by' explicitly in the select statement. I would like to know as to why this behavioral difference occurs due to change in compatibility. Also please let us know as to what type of other issues might face as a result of this compatibility migration.