BUG: Formating queries fails if GO statement is not on a line of its own

Hi
It seems that the formatting fails when there is a GO statement on the same line as another query. 
I get an error trying to format the following query:

SELECT * FROM Felles.DimAlder da; GO 

I am on version 10.13.8.680 on SSMS 19
Tagged:

Best Answer

  • Jon_KirkwoodJon_Kirkwood Posts: 441 Gold 1

    Hi @gerthauan

     Thank you for reaching out on the Redgate forums.

     This looks to be expected behaviour in handling a GO command on the same line as a T-SQL statement.

     

    From Microsoft;

    A Transact-SQL statement cannot occupy the same line as a GO command. However, the line can contain comments.

    Link

     Running your command without SQL Prompt brings up the same error directly in SSMS.

     


    I don't believe this is a bug in SQL Prompt but a genuine error passed through from SSMS

    Jon Kirkwood | Technical Support Engineer | Redgate Software

Answers

  • gerthauangerthauan Posts: 9 New member
    Yeah, I was aware of that. Was just hoping that SQLPrompt would be able to format some stuff before parsing it. I sometimes get queries in one long line of code that would be nice to be able to format. Thanks anyway.
Sign In or Register to comment.