Results 1 to 6 of 6

Thread: start./stop method

  1. #1
    Join Date
    Jun 2003
    Posts
    3

    Unhappy start./stop method

    Hi,

    New here and hoping someone might be able to shed a little light on a problem I am having.

    I have a job scheduled, which needs to be periodically stopped and then restarted.
    After looking through various places I think the start method and stop method are the best bets?
    But not really sure to be honest.

    Can anyone give me some tips/pointers/opinions on what would be the best way to do this. (have tried to setup a job with the said method in each step - but it doesn't like my syntax.

    Thanks in advance

    Cheers
    Troy

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    if it is sql server 7 or 2000 then

    sp_start_job 'xyz_job'
    sp_stop_job 'xyz_job'


    if you want to stop and restart a service then

    NET START "service name"
    NET STOP "service name"


    BTW. what kind of job is that?

  3. #3
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    Can't you use Every hour, minute or seconds job frequency?

  4. #4
    Join Date
    Jun 2003
    Posts
    3
    You will have to excuse my vagueness, but the job is scheduled through Enterprise Mgr (SQL2000), and picks up a dts package to execute periodically.

    Frequency will work however not in this circumstance, as I need to stop the job, as it seems to hang open every now and again
    *yeah this is probably some problem with the VB code in the DTS package - but alas the person who wrote it cannot see anything wrong

    So stopping and starting the job - when it has hung open - works fine

    Havn't managed to get any success out of the sp_start_job but will continue to try things out.

    Cheers!

  5. #5
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    Do you get any message when you use sp_stop_job to stop the job?

  6. #6
    Join Date
    Jun 2003
    Posts
    3
    Not asides from the event log telling me that it failed.
    FYI what I have done, is setup another job and within that have a step which is of Type TSQL using the specific database and with the code:
    EXEC sp_start_job @job_name = 'my_job_name'

    It's parses fine, saves fine, and no error when actually runing the job asides from the event log.

    Thanks for the assistance

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •