Re: what word will stop everything after it in a SQL script?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Steve Kass (skass_at_drew.edu)
Date: 06/15/04


Date: Tue, 15 Jun 2004 00:28:48 -0400

AFN,

  Before each section you might need to run, put

/*

and after each section you might need to run, put

*/

When you highlight what you want, highlight only the code between the
comment delimiters. If you forget to highlight something, no code will
be executed, because it's all comments.

Note that you cannot include the batch separator GO inside a multi-line
comment. If any of the sections you need to execute contains GO, this
trick should still work, but instead of nothing happening if you
accidentally execute the entire script, you'll get an error about a
missing comment end mark.

Steve Kass
Drew University

AFN wrote:

>Actually, I don't know if the word "script" is correct or not, but here's my
>problem...
>
>I have a Query Analyzer script file that I keep open for lots of potential
>issues each day. I never run the whole thing. I just highlight the piece
>I need, and click play. I have about 300 statements in this file on my
>screen.
>
>The problem is when I forget to highlight something before clicking play.
>Suddenly it wants to execute everything on the screen. If I had update or
>delete statements somewhere on the screen, I'm worried it will execute them.
>It is only a developer database, but I don't want to waste time restoring
>it.
>
>Is there some keyword I can put at the top of the screen/file, so it will
>stop executing everything beneath it? I tried "stop" but that didn't work.
>I tried "use xyz" but unless xyz is a real database, it won't work either,
>and I don't want to specify a real database name. I could create a database
>name just for this purpose, but that seems wasteful if there's a keyword
>that does what I want. Is there?
>
>
>
>



Relevant Pages

  • Re: Can lines collection be used to assist me in automatically numbering lines?
    ... Why else would you waste your time commenting on ... I don't say this to be mean and nasty, I say this so that you will only post the questions that you can't answer with the easy research. ... As for debugging without line numbers; I add a line with just the Resume command on it below the Resume ExitLable line (where it will never execute during regular processing). ... I then click on the Resume line below and hit CTRL-F9 which moves the highlight to that line. ...
    (comp.databases.ms-access)
  • Re: Duplicate Data
    ... The VBA editor will pop up and you will see a line highlighted ... That is the line that will execute next. ... >> line will execute and the next line will highlight. ... >> Private Sub Form_BeforeUpdate ...
    (microsoft.public.access.forms)
  • Re: SQL 2005 Query Execution for selected text using Right Click
    ... It does not deselect if you right click on the empty window in Query Analyzer as you mentioned. ... execute and then right click in the the Query Editor to Execute the ... it would save the highlight and execute only the text which is highlighted. ...
    (microsoft.public.sqlserver.setup)
  • Re: Duplicate Data
    ... The VBA editor will pop up and you will see a line highlighted ... That is the line that will execute next. ... > line will execute and the next line will highlight. ... > Private Sub Form_BeforeUpdate ...
    (microsoft.public.access.forms)
  • Re: Duplicate Data
    ... That is the line that will execute next. ... line will execute and the next line will highlight. ... Private Sub Form_BeforeUpdate ... >> Have you run it in debug mode and stepped through it to see what it is doing? ...
    (microsoft.public.access.forms)