|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Run Job From TSQLDear All,
I need some help on this problem. I create a job on SQL Agent, the job had schedule as selected date and time, but I want to have a optional choise to user to allow them start the job at the web page, so I try to create a store procedure to start the job and return the outcome for the job (Fail or success). And I use msdb.dbo.sp_start_job to start the job, now I face the problem how can I know the job are finished and after the job completed, I need to check the result of the job. Can give me some idea, what should I do for this. TQ hi
probably you can have a log table. The jon logs the data into the table. and you can read it from the web page of u can have ur sp return a value. did this answer your question. -- Show quotebest Regards, Chandra http://chanduas.blogspot.com/ http://groups.msn.com/SQLResource/ --------------------------------------- "Judy" wrote: > Dear All, > I need some help on this problem. > > I create a job on SQL Agent, the job had schedule as selected date and time, > but I want to have a optional choise to user to allow them start the job at > the web page, so I try to create a store procedure to start the job and > return the outcome for the job (Fail or success). And I use > msdb.dbo.sp_start_job to start the job, now I face the problem how can I know > the job are finished and after the job completed, I need to check the result > of the job. Can give me some idea, what should I do for this. > > TQ > sp_hlep_job will give you the status and such but you will have to poll for
it periodically. -- Show quoteAndrew J. Kelly SQL MVP "Judy" <J***@discussions.microsoft.com> wrote in message news:97716C52-85C6-41F0-8BE8-EFB61EF3E0FD@microsoft.com... > Dear All, > I need some help on this problem. > > I create a job on SQL Agent, the job had schedule as selected date and > time, > but I want to have a optional choise to user to allow them start the job > at > the web page, so I try to create a store procedure to start the job and > return the outcome for the job (Fail or success). And I use > msdb.dbo.sp_start_job to start the job, now I face the problem how can I > know > the job are finished and after the job completed, I need to check the > result > of the job. Can give me some idea, what should I do for this. > > TQ > ....or check out this article about how to use xp_sqlagent_enum_jobs to
be able to deal with the results since the results from sp_help_job
cannot be inserted into a table.
[url]http://www.databasejournal.com/article.php/10888_3491201_2[/url] /Magnus -- birger ------------------------------------------------------------------------ Posted via http://www.codecomments.com ------------------------------------------------------------------------ |
|||||||||||||||||||||||