Order By Index doesnt work any more afer sql 2019 update.

Rod Martin 136 Reputation points
2021-09-13T13:09:09.23+00:00

Very simple query. I just need to sort by Index. Used to do this all the time. Whats the deal?

SELECT TOP (1000) [Index]
      ,[Product]
      ,[Company]
      ,[WONum]
      ,[MatlNum]
      ,[SealMatlNo]
      ,[ValveOptions]
      ,[Misc#]
      ,[5]
  FROM [Powerapps].[dbo].[SN_Test_DF_Idx_Full2]
  order by Index asc

Msg 1018, Level 15, State 1, Line 12
Incorrect syntax near 'Index'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required. See SQL Server Books Online for proper syntax.

Other columns work fine. This has neven been an issue before.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,126 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,586 questions
0 comments No comments
{count} votes

1 additional answer

Sort by: Most helpful
  1. Rod Martin 136 Reputation points
    2021-09-13T13:17:21.237+00:00

    @Olaf Helper ,

    Yep! That did it.

    So, is it bad form to name this column "Index"???

    Thx.