Thursday, March 8, 2012

Control flow in scripts and 'GO'

(Same problem as yesterday).
Using controlflow in scripts and using 'GO' in a script
conflicts.
I use the control flow to check if the scripts are run
in the correct order and have not run before.
Some scripts 'create' views so a 'GO' is needed
in those scripts. This conflicts with the controlflow.
Any solutions to this 'problem' ?
ben brugmanControl of flow handling is confined inside a batch, we can't change this. S
o the 'solution' depends
on what you want to do with the control of flow handling.
If you are after exiting the script on error, you can do a raiserror with st
ate 127 if you execute
the script using OSQL (this doesn't work with QA).
Or do a raiserror with a severe severity level. Check out the scripts for pu
bs and northwind for how
this can be done.
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=...ls
erver
"ben brugman" <ben@.niethier.nl> wrote in message news:Oy3jy5i6DHA.1556@.tk2msftngp13.phx.gbl...[QUO
TE]
> (Same problem as yesterday).
> Using controlflow in scripts and using 'GO' in a script
> conflicts.
> I use the control flow to check if the scripts are run
> in the correct order and have not run before.
> Some scripts 'create' views so a 'GO' is needed
> in those scripts. This conflicts with the controlflow.
> Any solutions to this 'problem' ?
> ben brugman
>[/QUOTE]|||Thanks Tibor,
We are using the QA, using the raiserror with a high (above 19) severity
error, I think
is inappropriate and might lead to confusion.
So we have to work around this 'problem'.
quote:

> Check out the scripts for pubs and northwind for how
> this can be done.

What scripts are you refering to ? Where ?
Thanks for your time,
ben brugman
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:u6PSJSj6DHA.2380@.TK2MSFTNGP10.phx.gbl...
quote:

> Control of flow handling is confined inside a batch, we can't change this.

So the 'solution' depends
quote:

> on what you want to do with the control of flow handling.
> If you are after exiting the script on error, you can do a raiserror with

state 127 if you execute
quote:

> the script using OSQL (this doesn't work with QA).
> Or do a raiserror with a severe severity level. Check out the scripts for

pubs and northwind for how
quote:

> this can be done.
> --
> Tibor Karaszi, SQL Server MVP
> Archive at:

http://groups.google.com/groups?oi=...ublic.sqlserver
quote:

>
> "ben brugman" <ben@.niethier.nl> wrote in message

news:Oy3jy5i6DHA.1556@.tk2msftngp13.phx.gbl...
quote:

>
|||> What scripts are you refering to ? Where ?
The scripts I'm referring to are named instpubs.sql and instmsdb.sql, I beli
eve. They should be
found in the SQL Server install directory and on the SQL Server install CD.
You use these scripts to
re-create the database. However, I believe that they use the high severity l
evel technique.
From where are you executing the scripts? If you use OSQL or ISQL, I suggest
you check out the state
127 option.
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=...ls
erver
"ben brugman" <ben@.niethier.nl> wrote in message news:eJv0r1j6DHA.3804@.tk2msftngp13.phx.gbl...[QUO
TE]
> Thanks Tibor,
> We are using the QA, using the raiserror with a high (above 19) severity
> error, I think
> is inappropriate and might lead to confusion.
> So we have to work around this 'problem'.
>
> What scripts are you refering to ? Where ?
> Thanks for your time,
> ben brugman
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote i
n
> message news:u6PSJSj6DHA.2380@.TK2MSFTNGP10.phx.gbl...
> So the 'solution' depends
> state 127 if you execute
> pubs and northwind for how
> [url]http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver[/url
]
> news:Oy3jy5i6DHA.1556@.tk2msftngp13.phx.gbl...
>[/QUOTE]|||>
quote:

> From where are you executing the scripts? If you use OSQL or ISQL, I

suggest you check out the state
quote:

> 127 option.

We are using the QA for executing the scripts.
ben brugman
quote:

> --
> Tibor Karaszi, SQL Server MVP
> Archive at:

http://groups.google.com/groups?oi=...ublic.sqlserver
quote:

>
> "ben brugman" <ben@.niethier.nl> wrote in message

news:eJv0r1j6DHA.3804@.tk2msftngp13.phx.gbl...
quote:

in[QUOTE]
this.[QUOTE]
with[QUOTE]
for[QUOTE]
http://groups.google.com/groups?oi=...ublic.sqlserver[QUOTE]
>

No comments:

Post a Comment