Please note that GO is not an SQL keyword . This is the client batch separator used by SQL Server Management Studio and other client tools.
GO does not affect transaction volume. BEGIN TRAN will start the transaction over the current connection. COMMIT and ROLLBACK will abort the transaction. You can execute as many statements as you want. GO will follow the instructions separately.
As indicated by MSDN :
The TRY ... CATCH construct cannot span multiple batches.
Thus, BEGIN TRY, END TRY, BEGIN CATCH and ENCH CATCH cannot be divided into separate parts by the GO delimiter. They should appear in one request.
If you try to include a package separator in a TRY / CATCH statement, for example, invalid SQL:
begin try go end try begin catch go end catch
This will result in three different queries returning syntax errors:
1) begin try
Msg 102, Level 15, State 1, Line 1 Incorrect syntax near 'begin'.
2) end try begin catch
Msg 102, Level 15, State 1, Line 3 Incorrect syntax near 'try'.
3) end catch
Msg 102, Level 15, State 1, Line 6 Incorrect syntax near 'catch'.
source share