Here I am going to explain the SQL Server Batch Separator GO.
Batch: Batch is a group of one or more TSQL statements submitted to SQL server for the execution.
1- To separate batches we use batch separator “GO”
for example :
use sales go select * from xtsales2012
2- you can also use GO to define how much times you want to execute your batch.
Syntax: GO [count]
where count is a positive integer.
for example :
print 'sqlservergeeks' GO 5
3- GO is a utility command. So utilities never send GO to sql server.
4- playing with GO, means you can change this Batch Separator ‘GO’ with another option like ‘OK’
OPEN SSMS -> TOOLS -> Options
Now a popup window open here click on Query Execution in left side of this window.
here you can chage the text for batch separator. in my case i just type ok.
Now just restart the ssms to use the new batch separator
now we can use it as
use sales ok select * from xtsales2012
NOTE : Changeing batch separator is not a good idea. here we changed batch separator in SSMS only, this can not change GO as batch separator in sqlcmd utility. suppose if you run some TSQL script on your server,created by another person on another server using batch separator GO, then it will give errors on your server.
Like us on FaceBook | Follow us on Twitter | Join the fastest growing SQL Server group on FaceBook
Follow me on Twitter | Follow me on FaceBook
One Comment on “SQL Server Batch Separator GO”
Explain with snapshot and step by step how to calculate an Query Execution Time in Sql Server 2008.
Thanks in advance