SP call a Job?

  • Can I create a stored procedure that executes a job?  Why, I want to have an asp.net admin page that executes a job.  Any ideas.  I know that I can call a DTS from a stored procedure, but what about a job, if so any examples?

  • You need to call sp_start_job, but only the job owner can call this for a job.

  • The stored procedure worked, but I have another issue.  The job owner is "sa", the stored procedure permissions are for "ASPUser".  When I run the stored procedure from Query Analyzer, it works fine, but if I run the stored procedure from a Web Service (.asmx) page, I get an error.

    System.Data.SqlClient.SqlException: The specified @job_name ('BB3 - Update Purchase and Promo Data') does not exist.

    Any ideas on how to work around this?

  • When you run in QA you run below your own login wich is problably a member of "system administrator", because thats when you are able to run/execute jobs owned by sa-account. My suggestion would be that you change the owner of the job to the user who should be able to run it "ASPUser". Sa, and accounts within system administrator will still be able to run the job.


    robbac
    ___the truth is out there___

Viewing 4 posts - 1 through 3 (of 3 total)

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