How can we help you today? How can we help you today?

Bug - Semicolons added to GO if GO followed by CTE (WITH)

SQL Prompt: 9.0.9.3951 (latest as of this writing)

Simplest reproducible I was able to come up with (entirety of the script):

SELECT a=1;
GO
WITH base AS (SELECT b=1) SELECT * FROM base o;

-- Result:

SELECT a=1;
GO; -- <<== ADDS INVALID SEM-COLON
WITH base AS (SELECT b=1) SELECT * FROM base o;

-- NOTE: Issue does not occur if the WITH has a semicolon immediately preceding. But this is just bad SQL:

SELECT a=1;
GO -- <<== WILL NOT ADD SEMICOLON
;WITH base AS (SELECT b=1) SELECT * FROM base o;

-- OR

SELECT a=1;
GO -- <<== WILL NOT ADD SEMICOLON
;
WITH base AS (SELECT b=1) SELECT * FROM base o;

EDIT: remove square brackets to not force forum into bbcode
alicorn68
0

Comments

3 comments

  • alicorn68
    Would someone from RedGate please attempt to reproduce this issue?

    If it helps I have attached one of the styles tested. All styles seem to have the same issue.

    Note: This issue is not shown (does not occur) when editing the style and using "Preview current query"
    alicorn68
    0
  • alicorn68
    Just updated to 9.0.10.4053. This is still reproducible.
    alicorn68
    0
  • RichardL
    Hi @alicorn68

    This looks like a question that one of Support engineers will need to investigate for you.

    If you've a got support contract, please send us a ticket. Provide as much information as you can - screenshots of any errors, log files etc – so we can help you as fast as possible.
    If you're not covered by a Support contract at the moment, email our Sales team at sales@red-gate.com, and they'll be able to help.
    RichardL
    0

Add comment

Please sign in to leave a comment.