would like to know because of " Go " in the command below:
ALTER TABLE clie ADD clie_ind_rest CHAR(1) NULL
go
UPDATE clie SET clie_ind_rest='N'
go
ALTER TABLE oper ADD oper_vl_cessao DECIMAL(17,2) NULL
go
Thank you!Hi Frank
GO is not a SQL Command. It is used by the tool, Query Analyzer or osql, to
separate your code into separate batches, and then each batch is sent to SQL
Server, and parsed, optimized, compiled and executed separately. There are
rules about what can and cannot be in the same batch. Please read about
'batches' in the Books Online.
I am not sure exactly what you are asking in this post.
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Frank Dulk" <fdulk@.bol.com.br> wrote in message
news:e20MNQnLFHA.2468@.tk2msftngp13.phx.gbl...
> would like to know because of " Go " in the command below:
> ALTER TABLE clie ADD clie_ind_rest CHAR(1) NULL
> go
> UPDATE clie SET clie_ind_rest='N'
> go
> ALTER TABLE oper ADD oper_vl_cessao DECIMAL(17,2) NULL
> go
>
> Thank you!
>|||appeared another doubt.
Well, GO determines the end of each batch. OK.
In BOL:
"Assume there are 10 statements in a batch. If the fifth statement has a
syntax error, none of the statements in the batch are executed. If the batch
is compiled, and the second statement then fails while executing, the
results of the first statement are not affected because it has already
executed."
(I understand that will be executed)
For my example above, with 3 instructions does make some difference I to
place GO at the end of each one?
Thank you!
"Kalen Delaney" <replies@.public_newsgroups.com> escreveu na mensagem
news:OlNAaXnLFHA.3760@.TK2MSFTNGP12.phx.gbl...
> Hi Frank
> GO is not a SQL Command. It is used by the tool, Query Analyzer or osql,
to
> separate your code into separate batches, and then each batch is sent to
SQL
> Server, and parsed, optimized, compiled and executed separately. There are
> rules about what can and cannot be in the same batch. Please read about
> 'batches' in the Books Online.
> I am not sure exactly what you are asking in this post.
> --
> HTH
> --
> Kalen Delaney
> SQL Server MVP
> www.SolidQualityLearning.com
>
> "Frank Dulk" <fdulk@.bol.com.br> wrote in message
> news:e20MNQnLFHA.2468@.tk2msftngp13.phx.gbl...
>|||> For my example above, with 3 instructions does make some difference I to
> place GO at the end of each one?
Why don't you try it?
Sunday, February 12, 2012
Command GO
Labels:
belowalter,
char,
clie,
clie_ind_rest,
command,
database,
microsoft,
mysql,
nullgoupdate,
oracle,
server,
sql,
table
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment