ScriptDom parser for Sql Server 2022 fails to parse IGNORE NULLS clause
See original GitHub issue- SqlPackage or DacFx Version: 160.6266.0-preview
- .NET Framework (Windows-only) or .NET Core: .NET 6.0 (Core)
- Environment (local platform and source/target platforms): N/A
Steps to Reproduce:
- Create a new C# Console Project
- Add latest Nuget package for Microsoft.SqlServer.DacFx (160.6266.0-preview)
- Run code below
using Microsoft.SqlServer.TransactSql.ScriptDom;
var parser = new TSql160Parser(true); //sql server 2022 parser
IList<ParseError> errors;
parser.ParseExpression(new StringReader("LAST_VALUE(Measure) OVER()"), out errors);
//no parsing errors
parser.ParseExpression(new StringReader("LAST_VALUE(Measure) IGNORE NULLS OVER()"), out errors);
//parsing error! "Incorrect syntax near IGNORE." This should parse succesfully
Console.ReadLine();
Did this occur in prior versions? If not - which version(s) did it work in? Not applicable because the Sql Server 2022 parser (TSQL 160 didn’t exist in prior versions).
Documentation about the support for IGNORE NULLS / RESPECT NULLS in Sql Server 2022 is here: https://docs.microsoft.com/en-us/sql/t-sql/functions/last-value-transact-sql?view=sql-server-ver16#-ignore-nulls--respect-nulls-
Issue Analytics
- State:
- Created a year ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
ScriptDom parser for Sql Server 2022 fails to parse LAG/ ...
ScriptDom parser for Sql Server 2022 fails to parse LAG/LEAD with IGNORE NULLS clause #213 ... After #133, the parser can parse IGNORE|RESPECT...
Read more >Microsoft.SqlServer.TransactSql.ScriptDom.TSqlParser ...
SqlServer.TransactSql.ScriptDom heavily to process some SQL scripts. Our understanding is that the parser is supposed to be full fidelity.
Read more >Dan Guzman's Blog | Microsoft SQL Server Technical Articles
Parsing Overview. Scripts are parsed by invoking the Parse method of T-SQL script DOM library TSqlParser class. The parser understands the ...
Read more >sql - NULL values are excluded. Why?
The answer, as pointed by Martin Smith and Sumo is that it is supposed to exclude NULL, because NULL is not a value....
Read more >Working with SQL NULL values
This article will show functions and operators for handling SQL NULL values.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@zijchen I can confirm that parsing of the expression above now works on version 161.6337.0-preview.
However, I find the object model weird. Why is the
IgnoreRespectNulls
property a list of Identifiers?We would expect a proper Fragment class IgnoreRespectNullsClause or maybe a simple a simple enum
Maybe something along the following lines?
p.s.: I also tested a long standing bug causing the parser to fail to parse nested IIF calls. I’m pleased to see this appears to be fixed!
I see a new stable version of the package was released yet this is still not fixed