microsoft / SqlScriptDOM

ScriptDOM/SqlDOM is a .NET library for parsing T-SQL statements and interacting with its abstract syntax tree

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for new SQL Server 2022 "IS [NOT] DISTINCT FROM" TSQL language enhancement.

mcenzato opened this issue · comments

I've updated the package to the last version 161.8901.0 but still the new Sql 2022 TSQL syntax "IS [NOT] DISTINCT FROM" is not reconized and results in a syntax error.
SSMS 19.1 recognizes this, older versions don't.
Try this statment: it works fine if executed but fails in parsing using the package:

DECLARE @i1 int = null;
DECLARE @i2 int = 10;
DECLARE @i3 int = 10;
DECLARE @i4 int = null;
SELECT 
	Test1 = CONCAT('@i1 ', IIF(@i1 IS DISTINCT FROM @i2, '!=', '=='), ' @i2'),
	Test2 = CONCAT('@i1 ', IIF(@i1 IS DISTINCT FROM @i3, '!=', '=='), ' @i3'),
	Test3 = CONCAT('@i1 ', IIF(@i1 IS DISTINCT FROM @i4, '!=', '=='), ' @i4'),
	Test4 = CONCAT('@i2 ', IIF(@i2 IS DISTINCT FROM @i3, '!=', '=='), ' @i3'),
	Test5 = CONCAT('@i2 ', IIF(@i2 IS DISTINCT FROM @i4, '!=', '=='), ' @i4'),
	Test6 = CONCAT('@i3 ', IIF(@i3 IS DISTINCT FROM @i4, '!=', '=='), ' @i4')