web 2.0

Batch In SQL Server 2000

Batch is a collection of commands that are sent at once by an application to SQL Server for execution. SQL Server to copy the commands from a batch into an execution plan. Furthermore, the commands in the execution plan is run one by one.

For example, in the execution plan there is an error, then all commands in the batch will not be done. If there is a run-time error, such as overflow or a constraint violation will occur the following things :
  1. If there is a run-time, the relevant commands and the commands later dismissed.
  2. If constraint violations occur, only the relevant commands dismissed, while commands thereafter will be continued.
Commands are executed before the run-time errors will not be affected. If the batch is in a transaction, and error causes rollback, modification of data that have not been in-commit will be aborted.

For example there are five commands in a batch. If the third command syntax errors, the command will not run. If the batch has been compiled and run second command fails, the outcome of the first command will not be affected because it has completed execution.


Post a Comment