Tuesday, July 27, 2010

SQL Go and Batches

The other day someone asked me how the GO command should be used with MS SQL Server. I must admit that it was one of those things that I just used without fully understanding what it is. So I researched it and found directly from the source (msdn page about GO and msdn page about Batches) a good technical explanation. In summary, the GO command is not a SQL command at all, instead it is a command used by our most common SQL tools (sqlcmd and osql utilities and SQL Server Management Studio Code editor) to signal the end of a batch. So what is a batch and how is it different then a transaction. The short answer is a batch is the group of commands sent all at once to the server from the client. A transaction consists of one or more batches.

No comments:

Post a Comment