Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in SQL by (6.1k points)
The SQL Server Management Studio (SSMS) is always inserting a GO command whenever I am creating a query using the right-click "Script As" menu.

Why is this happening actually and what does GO actually do?

1 Answer

0 votes
by (12.7k points)
edited by

GO is not a SQL keyword.

It is a batch separator used by the client tools (such as SSMS) to break the entire script up into batches.

As it is SQL Server Management Studio 2005 it appears that you can use GO with an int parameter, like below:

INSERT INTO mytable DEFAULT VALUES
GO 10

The above will insert 10 rows into mytable.

So GO will be executing the related SQL commands n times specified.

Want to get certified in SQL? Join this SQL Training course by Intellipaat.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...