Skip to content

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

@Pilchard123

Description

@Pilchard123

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions