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 BYclause 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