Options

Error in refactoring action

completejcompletej Posts: 2 New member
Good day,

Why can the following syntax not be reformatted?

use db; go    


But the following syntax can be reformatted?

use db; 
    go    



Win 10
SSMS v17.9.1
SQL Prompt v9.4.11.8220

Thank you for any advice.

Best Answer

  • Options
    Pete_RuizPete_Ruiz Posts: 123 Silver 4

    I believe because this is a batch separator and not a T-SQL statement and should be on it's own line in the first place. This seems to be in line with SSMS since executing this on the same line as a T-SQL statement will produce a syntax error.


    I'm going to run this by our developers to see if there's anything we can do about this. Thanks for bringing this up.

    Pete Ruiz
    Redgate Support

Answers

  • Options
    completejcompletej Posts: 2 New member
    Thanks Pete.

    I ran into it when trying to create a script for scheduling ssis jobs and wanted to format the output of dynamic sql to see if it was matching the ssms wizard output.  I ended up using a print statement instead of a select statement to gauge the output.  It's an extra step but not a huge deal.

    I use the hell out of SQL Prompt though.  Has really improved my workflow.  Thanks for the great tool.
Sign In or Register to comment.