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 |
|
sona
Yak Posting Veteran
68 Posts |
Posted - 2004-04-07 : 01:02:59
|
| i am calling a Procedure B From Procedure A.In Proc B i have to return a userdefined Error using Raiserror.In Proc A i have to capture that error using @@error to do some error handling.when i use "RAISERROR(' CREDIT LIMIT UPDATION FAILED IN CCSA DB',16,1)"in Procedure B, the procedure gets abruptly terminated and comes out of Procedure A without going into the exception handling part.What severity level should i use ???Please helpREgards,Deepa |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-04-07 : 01:36:55
|
| Don't use RAISERROR. Use RETURN @someNumber to exit the query.Call the procedure from Procedure A like I am doing in this set of examples. You can do what you need to do and raise the error at the end of ProcA in an error return section. Make sense?CREATE PROCEDURE test_returnASRETURN 5GOCREATE PROCEDURE test_return_wrap ASDECLARE @return INTEXEC @return = test_returnPRINT @return--Do what you need to do.--Then raise the errorGOEXEC test_return_wrapMeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
sona
Yak Posting Veteran
68 Posts |
Posted - 2004-04-07 : 01:48:33
|
| Thanks.My situation is this.Procedure B will update a Table.That table has a update Trigger.Inside the trigger on my failure case i want to return error and how can i handle it in my procedure b and then in procedure A.The raise error in trigger is aborting |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-04-07 : 08:57:11
|
| Set your raise level from 16 to 10 and try that.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
|
|
|