SQL SERVER – 2005 – SSMS Change T-SQL Batch Separator

I recently received one big file with many T-SQL batches. It was a very big file and I was asked that this file was tested many times and it can run one transaction. I noticed the separator of the batches is not GO but it was EndBatch. I have followed two options to run the whole batch in one transaction. Let us learn how to change T-SQL Batch Separator.

1) Mass replaces EndBatch with GO.
The only problem I had with is that if EndBatch word was used in another place, then batch separator it will replace there too. I searched and noticed that it was used in the name of the Stored Procedure. I finally came up with second method which worked fine.

2) Change the batch separator.
Go to Tools >> Options >> Change the Batch Separator to EndBatch from GO.

SQL Server utilities interpret GO as a signal that they should send the current batch of Transact-SQL statements to an instance of SQL Server. The current batch of statements is composed of all statements entered since the last GO, or since the start of the ad hoc session or script if this is the first GO.

Additional Read about GO operator: SQL SERVER – Explanation SQL Command GO

Reference: Pinal Dave (https://blog.sqlauthority.com)


Exit mobile version