Monday, March 12, 2012

Run Job From TSQL

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 kno
w
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.
TQhi
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.
best 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 tim
e,
> but I want to have a optional choise to user to allow them start the job a
t
> 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 k
now
> the job are finished and after the job completed, I need to check the resu
lt
> 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.
Andrew J. Kelly SQL MVP
"Judy" <Judy@.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 a
ble to deal with the results since the results from sp_help_job cannot be in
serted into a table.
http://www.databasejournal.com/arti...10888_3491201_2
/Magnus

No comments:

Post a Comment