|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Force job to fail using stored proc
I'm trying to do error trapping in SQL server and need to force the scheduled job to fail.
The scheduled job runs DTS packages and stored procs. STEP 1 In the DTS package I'm setting a column in a table to a value to be used as a flag. This is done at the end of the DTs package to indicate the processing is complete. (I had a problem recently where the DTS package reported completing normally but did not do any of the action in the package.) STEP 2 I use the stored proc to evaluate the value of the flag (column in the table) If this indicates that the DTS contents did not execute then the stored needs to send a return or error code to the job to force it to fail so that any subsequent steps are not run. I know that I can use RETURN to send back a return code, but from what i understand the scheduled job doesn't check this RETURN code value. Can I manually set @@ERROR to a value? How do I force fail the job? J. |
|
#2
|
|||
|
|||
|
This for anyone else viewing this.
I basically wanted to do workflow in the scheduled job. I've since been advised to run all the steps (Stored procs, batch files, DTS packages) inside one DTS package and use the workflow inside the DTS pkg to control errors. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > Force job to fail using stored proc |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|