DBMS: SQL Server
Upgrading from version 2008 to 2016.
I have this part of the code that is being flagged by the Upgrade adviser as Breaking Change.
Error: uses a constant expression which are not allowed in the
ORDER BY
clause in database compatibility level 90 or later
What am I missing here. To my understanding, I should not use constants here but like variables. Any help would be appreciated.
DECLARE ForeignColumn1 CURSOR LOCAL STATIC FOR
SELECT
a.COLUMN_NAME
, ROW_NUMBER() OVER (ORDER BY a.COLUMN_NAME) AS RowNumber
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE a
WHERE 1=1
AND a.CONSTRAINT_NAME = @Constraint
AND a.TABLE_NAME IS NOT NULL
AND a.COLUMN_NAME NOT LIKE
CASE
WHEN @SkipSite > 0 THEN
@CurrSite
ELSE
''
END
ORDER BY RowNumber
Best Answer
Going from 2008 to 2016 is jumping too far.
I suggest you to go move to 2012 first and then to 2016.
Now that you are on 2012 repeat the steps 1, 2 and 3 and move to 2016.