Posted by Erland Sommarskog on 12/29/06 22:41
Hugo Kornelis (hugo@perFact.REMOVETHIS.info.INVALID) writes:
> That depends on what is in the script. There is no length limit that I
> know of (there probably is SOME length limit, but so sky high that
> you'll never get to it for normal work). But there are some statements
> that have to run in a seperate batch.
And there are other statements that cannot be in the same batch, for
instance:
ALTER TABLE tbl ADD somenewcol int
UPDATE tbl SET somenewcol = 4711
This will fail to compile, since the new column does not exist when the
batch is compiled.
But this can be dealt with by putting such statments in EXEC().
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
[Back to original message]
|