Reply to Re: Basic Questions

Your name:

Reply:


Posted by BJMurphy on 02/14/07 22:22

On Feb 14, 4:54 pm, jim_geiss...@countrywide.com wrote:
> I'm not the expert that Erland is, but I think I know.
>
> GO and semicolon both serve to separate statements. But GO also
> separates batches.
>
> If you make 4 statements into one batch like this --
>
> statement1; statement2; statement3; statement4 GO
>
> ...and statement4 fails with an error, the affected objects are
> restored to the way they were before statement1.
>
> If you make them 4 separate batches like this --
>
> statement1 GO statement2 GO statement3 GO statement4 GO
>
> ... and statement4 fails with an error, the objects are restored to
> the way they were after statement 3.
>
> Jim

OK. It seems as though the variables that I had setup were only valid
and were local to the specific batch in which they were created. If I
have ten statements, some of which are codependent, but I know they
will run successfully, it seems like I would want to use semi-colons
because it will allow me to keep the values of the local variables
throughout the entire batch, since there is only one batch. Would the
codependent queries still work?

For example:

create table foo;
select * from bar into foo;
select * from foo where (true);

Is then equivalent to:
create table foo
go
select * from bar into foo
go
select * from foo where (true);

Again, assuming the queries run succesfully.

Is there a way to create global variables?

Thanks for your response, Jim. I appreciate the help. Also, don't
worry, a book is on the way (the highly recommended one that comes in
two parts, I forget the title and author, sorry), so I won't be
posting too many questions, hopefullly :-)

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация