Re: Stop execution of script

From: Jacco Schalkwijk (jacco.please.reply_at_to.newsgroups.mvps.org.invalid)
Date: 11/12/04


Date: Fri, 12 Nov 2004 10:23:14 -0000

If you are using Wise, I would move the decision logic whether to run the
script or not to the Wise script if possible, and design your SQL scripts to
run either completely or not at all.

-- 
Jacco Schalkwijk
SQL Server MVP
"x-rays" <xrays@discussions.microsoft.com> wrote in message 
news:AFCD07D3-68A6-4D28-BA65-9742D6413D4C@microsoft.com...
> Thanks responding Jacco,
> Yes I could that, but because the script will run through an upgrade 
> process
> (using setup of wise) it might stack the hole thing. Maybe I can capture 
> it,
> I'll try it in the next days.
> Maybe I can Use the WHILE..BREAK, I'll test it and let you know.
>
> Thanks in advance
>
> "Jacco Schalkwijk" wrote:
>
>> The label must be in the same batch as the GOTO, i.e. they can not be
>> separated by a GO.
>>
>> If you use osql to run a script, you can exit it by raising an error with
>> status 127:
>>
>> RAISERROR('Exiting now', 16, 127)
>>
>> If you run it in Query Analyzer, that won't work, but you can still abort
>> execution (and terminate the connection) by raising an error with 
>> severity
>> 20 or higher. You need to be a member of the sysadmin role to do this:
>>
>> RAISERROR('Exiting now', 20,1)
>>
>> -- 
>> Jacco Schalkwijk
>> SQL Server MVP
>>
>>
>> "x-rays" <xrays@discussions.microsoft.com> wrote in message
>> news:8CC09CCE-DD61-402D-BA19-3D0EBE4D6A24@microsoft.com...
>> > 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

  • automated shell script
    ... I tried to write the script, and this is what i have done so far(built ... if today .eqs. ... "Tuesday" then goto tuesday ...
    (comp.unix.shell)
  • FC1: efax: 23:00 Error: cant open pre-lock file
    ... That was the 1st error I got when attempting to run efax via the fax send ... I'm also not sure it was wise to add user read/write permissions to ... end the script. ...
    (Fedora)
  • Error 302 on Vista when using "Copy local file(s)" in Wise Package Studio
    ... We are getting a Error 302 Wise Error msg when downloading files from ... However the same script works fine on XP and 2000 machine. ... Are there any settings on Vista that is preventing these downloads? ...
    (microsoft.public.windows.vista.general)
  • Re: how good are the sagekey scripts?
    ... I have absolutely no problem with buying the script, as long as it does what ... Before we settled on Inno, I'd used the demo of wise to recreate our 97 ... I think we'll settle on Wise for price reasons (especially if it's a stop ... and as Installshield appear to have given up ...
    (microsoft.public.access.devtoolkits)
  • Re: Cleaning up files after MSI uninstall
    ... Anyone have good solution to removing "non-shared" program files and ... Created MSI install with Wise Installer for Windows for a VB6 Outlook ... (i.e. MSI script, "run once" script, Wise custom action ...
    (microsoft.public.vb.general.discussion)