TSQL - How to use GO inside of a BEGIN .. END block?

后端 未结 8 946
一生所求
一生所求 2020-12-02 18:06

I am generating a script for automatically migrating changes from multiple development databases to staging/production. Basically, it takes a bunch of change-scripts, and m

8条回答
  •  没有蜡笔的小新
    2020-12-02 18:33

    I ultimately got it to work by replacing every instance of GO on its own line with

    END
    GO
    
    ---Automatic replacement of GO keyword, need to recheck IF conditional:
    IF whatever
    BEGIN
    

    This is greatly preferable to wrapping every group of statements in a string, but is still far from ideal. If anyone finds a better solution, post it and I'll accept it instead.

提交回复
热议问题