WHAT IS A BATCH v7.0? A batch is a set of commands sent to SQL Server as one unit of work. The following will outline what happens when SQL Server receives a batch. The batch separator is the GO keyword. The examples below should assist in this concept. Assume the following table structure. CREATE TABLE TableX (Col1 INT NOT NULL). Batch #1 INSERT INTO TableX (Col1) VALUES (1) INSERT INTO TableX (Col1) VALUES (2) GO Batch #2 INSERT INTO TableX (Col1) VALUES (3) INSERT INTO TableX (Col1) VALU (4) GO Batch #3 INSERT INTO TableX (Col1) VALUES (NULL) INSERT INTO TableX (Col1) VALUES (5) GO Upon submitting a batch to SQL, the server takes it as a string of T- SQL commands and parses the string for syntax. If no syntax error(s) are found, as in Batch #1, then all of the statement(s) are executed. If a syntax error is found, as in Batch #2, then none of the statements are executed and SQL Server returns an error to the client. Note that Batch #3 is syntactically correct but will violate the NOT NULL constraint. This is still considered a syntax-valid batch so, even though the INSERT NULL command will fail, the second command is valid and will be executed/inserted into the table. Values 1, 2, and 5 will be inserted. Note that this behavior applies for constraint violations. Some run-time errors stop the current statement as well as subsequent statements within the batch. The following rules for batches are reprinted from MSDN Books Online: 1. CREATE DEFAULT, CREATE PROCEDURE, CREATE RULE, CREATE TRIGGER, and CREATE VIEW statements cannot be combined with other statements in a batch. 2. A table cannot be altered and then the new columns referenced in the same batch. 3. If an EXECUTE statement is the first statement in a batch, the EXECUTE keyword is not required. The EXECUTE keyword is required if the EXECUTE statement is not the first statement in the batch. ------------------------------------------