Can we use 'GO' multiple times in SQL Transaction?

前端 未结 3 2329
旧时难觅i
旧时难觅i 2021-02-18 21:15

Can We use GO statement mutiple times in a SQL Transaction. I am having a long T-SQL script and I want to run it in a SQL Transaction. If

3条回答
  •  不思量自难忘°
    2021-02-18 21:43

    GO is a nice keyword to use. The GO will complete the last code block and continue on to the next block. Yes you can use multiple GOs in a statement to break it up into multiple batches. But it would be better to use try/catch logic with a combination of GOs since you are doing transaction based logic. https://msdn.microsoft.com/en-us/library/ms175976.aspx this site gives you some examples on hoe to use it and if you run into a hitch you can output that error and continue on if you choose.

提交回复
热议问题