I am calling a job using sp_Start_Job and I want return a failed or successful bit.
How can I tell if the job errors? I'd like to return a simple 1 or 0 as an output in the proc.
Create Proc JobStart
@Error tinyint out
as
EXEC msdb.dbo.sp_start_job @job_name = 'Import CSV'
Something to the effect of:
IF job fails set @Error = 2
If success set @Errror = 1
TIA.