Batch vs SQL statement

Posted by AspOnMyNet on Stack Overflow See other posts from Stack Overflow or by AspOnMyNet
Published on 2010-04-28T18:51:42Z Indexed on 2010/04/28 19:17 UTC
Read the original article Hit count: 443

Filed under:
|
|

a)

A SQL statement is a single SQL command (for example, SELECT * FROM table1 or SET NOCOUNT ON). A batch on the other hand, is a number of SQL statements sent to the server for execution as a whole unit. The statements in the batch are compiled into a single execution plan. Batches are separated by the GO command

So the only difference between SQL statement and a Batch is that each SQL statement is sent to server as a separate unit and thus is compiled separately from other SQL statements, while SQL statements in a Batch are compiled together?

b) I assume one of major differences between a stored procedure and a Batch is that stored procedures are precompiled while Batches aren’t?

thanx

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server