Composite Transact-SQL Constructs: Batches, Scripts, and Transactions - Using Batches
(Page 2 of 4 )
Batches reduce the time and processing associated with transferring statements from client to server, as well as that associated with parsing, compiling, and executing T-SQL statements. If you need to execute a set of 100 Insert commands against

Figure 5-1. Executing selected code in the Query window
a database, it is preferable to group them in one batch rather than send them to the server as 100 separate statements. The overhead involved in sending 100 separate statements and receiving 100 separate results is very high. Network traffic will be increased unnecessarily, and the whole operation will be slower for the user.
Next: Batches and Errors >>
More MS SQL Server Articles
More By McGraw-Hill/Osborne
|
This article is excerpted from chapter five of the book Microsoft SQL Server 2005 Stored Procedure Programming in T-SQL and .NET, written by Dejan Sunderic (McGraw-Hill/Osborne, 2006; ISBN: 0072262281). Check it out today at your favorite bookstore. Buy this book now.
|
|