An error in the editor for Ignore Nulls

JAV 0 Reputation points
2024-08-30T07:18:38.8866667+00:00

Hi All,

I have a query that retrieve the previous row info for the specific column.

The attached image query can be successfully executed. However there is a syntax error line on the editor. The execution engine of the database understand and processes the Ignore Nulls clause, but the syntax checker in the SQL editor does not. This leads to a scenario where you see an error in the editor, but the query runs successfully. Even though , it is a cosmetic issue but it will be very hard for me to identify the genuine syntax error for very long query.

I using the 2022 SQL version. Below are the things I have done but still not able to fix it.

  1. Upgraded the SSMS from 19.2 to 20.2 .
  2. Change database compatibility to latest SQL Server 2022 (160)

Anyone can help me to fix this?

User's image


SELECT 
* 
,CASE
	WHEN NAME1 IS NULL  THEN
	LAST_VALUE(NAME1) 
	IGNORE NULLS
	OVER (ORDER BY CONTACTID) 
	ELSE NAME1
	END AS LAST_NAME_PREVIOUS

FROM [dbo].[TBL_CLIENT]

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

1 answer

Sort by: Most helpful
  1. LiHongMSFT-4306 28,806 Reputation points
    2024-08-30T08:24:39.8+00:00

    Hi @JAV

    I'm the same as you. My guess is that SSMS hasn't updated the latest syntax checks yet.You could go to the feedback site and find the relevant thread upvoted. The product team may fix it in a subsequent version update.

    Best regards,

    Cosmog


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.