Showing posts with label sp_start_job. Show all posts
Showing posts with label sp_start_job. Show all posts

Friday, February 24, 2012

How to know the sp_start_job job has failed?

How to know the sp_start_job job has failed?
No matter the job run successfully or not, we can only know that it started
successfully.
Job 'JobName' started successfully.
Is there any way we can know the job run result?
Thanks.You can get the information for the job (including the result of the last
run) with sp_help_job.
Jacco Schalkwijk
SQL Server MVP
"Tee" <thy@.streamyx.com> wrote in message
news:eUm5Jrr1EHA.1404@.TK2MSFTNGP11.phx.gbl...
> How to know the sp_start_job job has failed?
> No matter the job run successfully or not, we can only know that it
> started
> successfully.
> Job 'JobName' started successfully.
> Is there any way we can know the job run result?
>
> Thanks.
>

How to know the sp_start_job job has failed?

How to know the sp_start_job job has failed?
No matter the job run successfully or not, we can only know that it started
successfully.
Job 'JobName' started successfully.
Is there any way we can know the job run result?
Thanks.If you check the sp_help_job command you can configure an
NT event to see whether the job has succeded or failed.
Peter
"Status quo, you know, that is Latin for "the mess we're
in."
Ronald Reagan
>--Original Message--
>How to know the sp_start_job job has failed?
>No matter the job run successfully or not, we can only
know that it started
>successfully.
>Job 'JobName' started successfully.
>Is there any way we can know the job run result?
>
>Thanks.
>
>.
>|||You can get the information for the job (including the result of the last
run) with sp_help_job.
--
Jacco Schalkwijk
SQL Server MVP
"Tee" <thy@.streamyx.com> wrote in message
news:eUm5Jrr1EHA.1404@.TK2MSFTNGP11.phx.gbl...
> How to know the sp_start_job job has failed?
> No matter the job run successfully or not, we can only know that it
> started
> successfully.
> Job 'JobName' started successfully.
> Is there any way we can know the job run result?
>
> Thanks.
>

How to know the sp_start_job job has failed?

How to know the sp_start_job job has failed?
No matter the job run successfully or not, we can only know that it started
successfully.
Job 'JobName' started successfully.
Is there any way we can know the job run result?
Thanks.
You can get the information for the job (including the result of the last
run) with sp_help_job.
Jacco Schalkwijk
SQL Server MVP
"Tee" <thy@.streamyx.com> wrote in message
news:eUm5Jrr1EHA.1404@.TK2MSFTNGP11.phx.gbl...
> How to know the sp_start_job job has failed?
> No matter the job run successfully or not, we can only know that it
> started
> successfully.
> Job 'JobName' started successfully.
> Is there any way we can know the job run result?
>
> Thanks.
>

Sunday, February 19, 2012

How to know a Job Status from Stored Procedure

To execute a job from VB, I use stored procedure with T-SQL :

EXEC sp_start_job @.job_name = 'DTSName'

>From BOL, I know that procedure return 0 (success) or 1 (failure), but
that's only to tell user that job successfully started, right?
What I need is how to know is that job have already executed
successfully or
failed, so if success i will execute another code.

Please help me, thanksyou might want your DTS package to tell you when it fails or not and
based on that execute your next step of code. just a thought.

How to know a Job Status from Stored Procedure

To execute a job from VB, I use stored procedure with T-SQL :

EXEC sp_start_job @.job_name = 'DTSName'

>From BOL, I know that procedure return 0 (success) or 1 (failure), but
that's only to tell user that job successfully started, right?
What I need is how to know is that job have executed successfully or
failed, so if success i will execute another code.

Please help me, thanksSee sp_help_job in Books Online. Alternatively, you could use SQL-DMO
from VB to get the CurrentRunStatus and/or LastRunOutcome property of
the Job object. Another option would be to add more steps to the job
itself, so that if the first step fails, it runs your extra code.

Simon|||But when I have execute sp_help_job if i don't know the job was
finished or not?|||The current_execution_status column tells you if the job is running;
the last_run_outcome columns tells you what happened the last time the
job finished.

If you want something to happen only when the job succeeds (or fails),
then it might be easiest to add another job step, as I mentioned. Then
you don't have to keep checking the job status from the client.

Simon