O'Reilly logo

Microsoft® SQL Server™ 2000 Programming by Example by Carlos Eduardo Rojas, Fernando G. Guerrero

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Programming Scripts and Batches

The main characteristic of a batch is that it is processed by SQL Server as a unit, similar to stored procedures. A batch might contain one or more Transact-SQL instructions, and the last statement in a batch is the GO statement. However, some restrictions apply to batches. The statements CREATE DEFAULT, CREATE PROCEDURE, CREATE RULE, CREATE TRIGGER, and CREATE VIEW cannot appear more than once in a batch. If any of these statements appears in a batch, it must be the only statement. Hence, if you want to have more than one of these statements in the code, add a GO statement right after each one of them (thus creating multiple batches).

A script comprises one or more batches—each of them separated by a GO statement. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required