In previous sections, you saw how Query Store captures and stores data about queries and their execution plans. It is now time to see how Query Store can help you with migration. You will execute the same queries under different compatibility levels; firstly under 110 (which corresponds to SQL Server 2012) and 140, the compatibility level of SQL Server 2017. This action will simulate what can happen when you migrate a database to SQL Server 2017.
To simulate migration to SQL Server 2017, you will now change the compatibility level of the sample database to 110:
ALTER DATABASE WideWorldImporters SET COMPATIBILITY_LEVEL = 140;
Now, execute the same query from the previous section:
SET NOCOUNT ON;SELECT * FROM Sales.Orders ...