Abort SQL Server Agent job from a step


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Abort SQL Server Agent job from a step

  1. #1
    Shaun Higgins Guest

    Abort SQL Server Agent job from a step


    I have an SQL Server Agent Job that consists of 5 steps. The first step checks
    to see if a file exists on disk. If it does, then it performs some manipulation
    and continues with the next step. However, if the file does not exist, the
    next step is still invoked and fails because it needs the file. How can I
    exit a step with an error? ie. If file does not exist, then quit entire job.

  2. #2
    C. E. Buttles Guest

    Re: Abort SQL Server Agent job from a step

    Control-of-flow is part of the job step creation. See "Define Jobs" in BOL.

    "Shaun Higgins" <shiggins@businesspartners.co.za> wrote in message
    news:38db6daf$1@news.devx.com...
    >
    > I have an SQL Server Agent Job that consists of 5 steps. The first step

    checks
    > to see if a file exists on disk. If it does, then it performs some

    manipulation
    > and continues with the next step. However, if the file does not exist, the
    > next step is still invoked and fails because it needs the file. How can I
    > exit a step with an error? ie. If file does not exist, then quit entire

    job.


  3. #3
    Celia Guest

    Re: Abort SQL Server Agent job from a step


    Sounds like a job for the Windows Script host (running VBScript) and the SQL
    Server DMO (data management object model). Look for those technologies on
    Microsoft site.

    "Shaun Higgins" <shiggins@businesspartners.co.za> wrote:
    >
    >I have an SQL Server Agent Job that consists of 5 steps. The first step

    checks
    >to see if a file exists on disk. If it does, then it performs some manipulation
    >and continues with the next step. However, if the file does not exist, the
    >next step is still invoked and fails because it needs the file. How can

    I
    >exit a step with an error? ie. If file does not exist, then quit entire

    job.


  4. #4
    Peter Czarnecki Guest

    Re: Abort SQL Server Agent job from a step


    I've been developing a similar Job. The way i've structure it is:
    -make an ActiveX script which checks for the existance of the file
    -if the file exists, then execute a DTS package to import the file, finished
    the job 'Successfully'
    -if the file does not exist, then finish the job 'Successfully'

    In my case, if the file does not exist, then it's not an error, I simply
    check the next day...

    "Shaun Higgins" <shiggins@businesspartners.co.za> wrote:
    >
    >I have an SQL Server Agent Job that consists of 5 steps. The first step

    checks
    >to see if a file exists on disk. If it does, then it performs some manipulation
    >and continues with the next step. However, if the file does not exist, the
    >next step is still invoked and fails because it needs the file. How can

    I
    >exit a step with an error? ie. If file does not exist, then quit entire

    job.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center