Procedure running Job or package

  • I currently store packages on the file system and then have jobs run the packages.  Well now I need to automate this a bit more where a person updates a field and then I kick off the job.  I am not sure the best way to do this.  I will want to keep the job that runs twice a day.

    1) Can I have a job that does the following check

    IF(Select Count(*) from XXX) <> 0

    BEGIN

    Run Job XXXX (I do not know the syntax)

    END

    Then I would just have this job run when the other job is not running.  Or

    Can I launch a 2005 job from SQL 2000 (Data is being imported before going to remote server)?  From a proc or DTS

  • - with sql2000 I do this by defining an alert that is coupled to a job and have the user just perform the raiserror

    - PROCEDURE sp_start_job

      @job_name    sysname          = NULL,

      @job_id      UNIQUEIDENTIFIER = NULL,

      @error_flag  INT              = 1,    -- Set to 0 to suppress the error from sp_sqlagent_notify if SQLServerAgent is not running

      @server_name NVARCHAR(30)     = NULL, -- The specific target server to start the [multi-server] job on

      @step_name   sysname          = NULL, -- The name of the job step to start execution with [for use with a local job only]

      @output_flag INT              = 1     -- Set to 0 to suppress the success message

     

     is stored in msdb. you can use it to start a job.

    Only sa can start all jobs, other users can only start jobs they own.

    Check BOL

    - In sql2005 Service Broker can help you with this. Check BOL

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply