GO command You can write sql statements/commands using tools such as SQL Server Management Studio Code Editor and sqlcmd . Then the sql code is executed by SQL Server. Above tools merely send your sql code to the SQL server to be executed. SQL Server does NOT use GO command. It is never sent to the server. Rather, GO command is used by SQL Server Management Studio Code Editor, sqlcmd and osql utilities. GO signals the end of a batch of Transact-SQL statements to the SQL Server utilities. source What GO command do is to instruct the sqlcmd , osql , SQL Server Management Studio Code Editor etc. to send the code up until the GO command as one batch. Basically it is a code (batch) separator. The SQL Server utilities never send a GO command to the server. Why and When GO command is needed Before executing the sql code, SQL server validates it. If, for example, (single batch of) sql code includes both CREATE and ALTER statements, when validating ALTER statemen...
Article and blogs on Technology, Everyday Life, and more