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.
- Upgraded the SSMS from 19.2 to 20.2 .
- Change database compatibility to latest SQL Server 2022 (160)
Anyone can help me to fix this?
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]