Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

ScriptDom parser for Sql Server 2022 fails to parse exec variable with version

Open
#27 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp, sql

Research direction

Start with the TSql160Parser entry point and run the three CREATE PROCEDURE examples from the issue in a .NET 6 console project using Microsoft.SqlServer.DacFx 161.6367.0-preview. Compare parsing of EXEC @ProcName with and without ;2, then trace the parser path for the variable form. Done means the final example parses without an error near the semicolon.

Written by the indexing model from the issue text.

Description

bug
  • SqlPackage or DacFx Version: 161.6367.0-preview
  • .NET Framework (Windows-only) or .NET Core: .Net 6.0
  • Environment (local platform and source/target platforms): N/A

Steps to Reproduce:

  1. Create a new C# Console Project
  2. Add latest Nuget package for Microsoft.SqlServer.DacFx (161.6367.0-preview)
  3. Run code below
using Microsoft.SqlServer.TransactSql.ScriptDom;

var parser = new TSql160Parser(true); // Sql server 2022 parser

IList<ParseError> errors;

parser.Parse(new StringReader("CREATE PROCEDURE Proc1 AS EXEC ProcName;2"), out errors);
// No parsing errors

parser.Parse(new StringReader("CREATE PROCEDURE Proc1 AS DECLARE @ProcName SYSNAME = 'Proc2' EXEC @ProcName"), out errors);
// No parsing errors

parser.Parse(new StringReader("CREATE PROCEDURE Proc1 AS DECLARE @ProcName SYSNAME = 'Proc2' EXEC @ProcName;2"), out errors);
// Parsing error! "Incorrect syntax near ;." This should parse succesfully

Did this occur in prior versions? If not - which version(s) did it work in?
Not work in all prior versions.

(DacFx/SqlPackage/SSMS/Azure Data Studio)

Dominant language
GAP
Stars
277
Forks
43
Avg merge
6d 17h
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/SqlScriptDOM

All issues in microsoft/SqlScriptDOM

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.