microsoft / microsoft/sqlmanagementobjects

Block comments immediately before a batch separator prevent the separator being detected

Open
#196 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
143
Forks
28
PR merge metrics
No merged PRs in 30d

Description

In SSMS the code

SELECT 1
/* comments! */GO
SELECT 2

Will be sent for execution as two batches:

SELECT 1
/* comments! */

and

SELECT 2

If I try executing it through SMO, it is treated as one batch and is sent unchanged, with the GO in the middle causing an error. It doesn't seem to matter if there is any whitespace between the end of the comment and the GO, nor does the block comment being spread across multiple lines have any effect.

This behaviour is in packages up to 172.64.0 (the latest at time of writing), from at least as far back as 160.2004021.0. I would have gone further back but I couldn't easily find the standalone SMO DLLs.

I tested with net48, net8.0 and net 9.0.

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

No source file or test is named. Reproduce the issue with the SQL shown through SMO, then trace the batch-separator parsing entry point and compare its handling of block comments with SSMS. Done means GO is recognized as a separator after a block comment, including multiline comments and intervening whitespace, across the reported .NET targets.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.