Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 743369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:51:20+00:00 2026-05-14T08:51:20+00:00

I have read and read over MSDN, etc. Ok, so it signals the end

  • 0

I have read and read over MSDN, etc. Ok, so it signals the end of a batch.

What defines a batch? I don’t see why I need go when I’m pasting in a bunch of scripts to be run all at the same time.

I’ve never understood GO. Can anyone explain this better and when I need to use it (after how many or what type of transactions)?

For example why would I need GO after each update here:

 UPDATE [Country]
   SET [CountryCode] = 'IL'
 WHERE code = 'IL'

 GO

 UPDATE [Country]
   SET [CountryCode] = 'PT'
 WHERE code = 'PT'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T08:51:20+00:00Added an answer on May 14, 2026 at 8:51 am

    GO is not properly a TSQL command.

    Instead it’s a command to the specific client program which connects to an SQL server (Sybase or Microsoft’s – not sure about what Oracle does), signalling to the client program that the set of commands that were input into it up till the "go" need to be sent to the server to be executed.

    Why/when do you need it?

    • GO in MS SQL server has a "count" parameter – so you can use it as a "repeat N times" shortcut.

    • Extremely large updates might fill up the SQL server’s log. To avoid that, they might need to be separated into smaller batches via go.

      In your example, if updating for a set of country codes has such a volume that it will run out of log space, the solution is to separate each country code into a separate transaction – which can be done by separating them on the client with go.

    • Some SQL statements MUST be separated by GO from the following ones in order to work.

      For example, you can’t drop a table and re-create the same-named table in a single transaction, at least in Sybase (ditto for creating procedures/triggers):

    > drop table tempdb.guest.x1          
    > create table tempdb.guest.x1 (a int)
    > go
      Msg 2714, Level 16, State 1
      Server 'SYBDEV', Line 2
      There is already an object named 'x1' in the database.   
      
    > drop table tempdb.guest.x1          
    > go
    > create table tempdb.guest.x1 (a int)
    > go
    >
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read over this which sort of gives an explanation of when you'd
I have read over a dozen posts and answers ... to no avail. What
I have read over the documentation, scoured the interwebs, and it seems what I
I have read this iFrame workaround for IE6. But I really don't understand on
Alright...I've given the site a fair search and have read over many posts about
I'm new to ruby world and i'm currently studying it. I have read over
I have read all over the place how WordPress is only capable of working
I have read the docs over and over trying to wrap my head around
Please help me undestand how order by influences to over clause. I have read
I have quickly read over the Microsoft Lambda Expression documentation. This kind of example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.