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

alicorn68alicorn68 Posts: 9 Bronze 1
edited February 14, 2018 12:57PM in SQL Prompt
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

Answers

  • alicorn68alicorn68 Posts: 9 Bronze 1
    edited February 20, 2018 11:12AM
    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"
  • Just updated to 9.0.10.4053. This is still reproducible.
  • 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.
    Customer Support
    Redgate Software
Sign In or Register to comment.