Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-01-20 : 09:35:57
|
Per Elsted writes "I have problem with a Scheduled Job that I can't solve. I've a job that runs everyday which will execute a Stored Proc. If the Stored Proc. return a specific value, I want the job to quit.I've looked at SQLTeam.com and http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_help_9rqa.asp, but did not find an answer to my question.However, it looks like there's Return Code indicating whether the job fails (1) or succeeds (0).How do I programmatically set this Return Code value, so that I can control whether the job fails or not?The idea with all this is that I want to do something when either the job fails or succeeds - e.g. sending an e-mail via ActiveX Scripting.-- Whenever @RetCodeForSP is not 0, the job must quit with successDECLARE @RetCodeForSP intEXECUTE @RetCodeForSP = sp_LoopThroughOrdersIF @RetCodeForSP <> 0 -- Set return code to 0, forcing this job to Quit With SuccessELSE -- Set return code to 1, forcing the job to Quit With Failure " |
|
|
graz
Chief SQLTeam Crack Dealer
4149 Posts |
Posted - 2003-01-20 : 09:35:57
|
| I'd take a look at the RASIERROR statement at the bottom of this article: http://www.sqlteam.com/item.asp?ItemID=2463 |
 |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2003-01-20 : 10:52:42
|
| No no no this isn't C, the return code isn't a signal to the operating system. Graz has your answer.Jonathan{0} |
 |
|
|
|
|
|