Re: Stop execution of script

From: x-rays (xrays_at_discussions.microsoft.com)
Date: 11/12/04


Date: Fri, 12 Nov 2004 01:18:03 -0800

Thanks responding Uri,
I tried that too but because of separate batch executions
the error that raises is:
A GOTO statement references the label 'EXIT' but the label has not been
declared.

"Uri Dimant" wrote:

> x-rays
> Perhaps you want to try GOTO.
>
> If 'a' <> 'b'
> begin
> print 'not equal'
> GOTO exit
> end
>
> exit:
> RETURN
>
>
>
> "x-rays" <xrays@discussions.microsoft.com> wrote in message
> news:94E9AB19-9C21-4DF9-A23B-2823A5B341DC@microsoft.com...
> > hello Experts,
> >
> > this question might be a dump one but i will ask it anyway.
> >
> > I run a script like the following:
> >
> > If 'a' <> 'b'
> > begin
> > print 'not equal'
> > return
> > end
> >
> > if object_id('MyStoredProcedure') Is not null
> > drop procedure MyStoredProcedure
> > GO
> >
> > CREATE Procedure MyStoredProcedure
> >
> > AS
> > set nocount on
> > select 'something'
> > set nocount off
> > GO
> >
> > So because a and b is not obviously equal I need the script to stop, but
> > because of GOs (separates executions) script will continue. Is there any
> way
> > to stop it at the point I want without using dynamic sql?
> >
> > Thanks in advance!
>
>
>



Relevant Pages

  • Re: On Local Error Goto Somewhere
    ... an EXIT DO or EXIT FOR. ... going if there is no label to show you the destination. ... IMO the GoTo statement has never been "THE" problem. ... ON ERROR GOTO MySubErr Dim lFNbr as long ...
    (microsoft.public.vb.general.discussion)
  • Re: Stop execution of script
    ... The label must be in the same batch as the GOTO, ... > I tried that too but because of separate batch executions ... > A GOTO statement references the label 'EXIT' but the label has not been ...
    (microsoft.public.sqlserver.programming)
  • Re: Perform loop enhancements
    ... >> simplicity. ... If you have two different types of your exit ... >> why not use a GOTO? ... Ranting about the label ...
    (comp.lang.cobol)
  • Re: Is David Fenton right about error handling? (re-post?)
    ... > Error Goto 0 a proper termination. ... after the Exit Function. ... Clears all property settings of the Err object. ... Exit Sub, Exit Function, Exit Property ...
    (comp.databases.ms-access)
  • Tail recursion syntactic sugar faked with TAGBODY-based construct?
    ... and provide a GOTO that takes argument expressions. ... in which a a label parameter is shadowed, ... (let (labels forms thunks thunk-gensyms) ... vars gensyms)) ...
    (comp.lang.lisp)

Loading