October 31, 2005 at 12:33 pm
I am working on multiple things right now and cannot focus upon this and my head just stopped working.
I have a developer with a main SP. It calls other SP's.
Basically, the first SP gets specific values, calls the second SP for either Inserts or Updates of that data, returns to the original calling SP and continues.
If there is an @ERROR in the called SP, she needs that returned and the calling SP to stop... I suggested an OUTPUT parameter in the second SP with a DEFUALT of zero, or it will trap the @ERROR if one occurrs.
SP1 ---------
Get Information.....
Call SP2 @MyError integer OUTPUT --------------
Do things with the data.
SET @MyError = @ERROR
-- suppose error occurs. Return @MyError to SP1 and stop processing.
This is the step where my brain stopped working... I am simply not seeing it. (I know this is simple and I have done it before, but I have other fires and I cannot get it immediately and a search of this site did not help...).
TIA
I wasn't born stupid - I had to study.
October 31, 2005 at 12:46 pm
exec lowersp @lowerspvarname = @localvarname OUTPUT
but I tend to use the RETURN value for passing errors
EXEC @localerrvar = lowersp @parm1=...
October 31, 2005 at 12:50 pm
Sorry, I'm not following you...
I wasn't born stupid - I had to study.
October 31, 2005 at 1:19 pm
create outerprocname....
declare @err int
exec sp_lowerproc @varnameinlowerproc = @err OUTPUT
OR
exec @err = sp_lowerproc ...
if the lowerproc does a RETURN @localerrvariable at end
But that proc would have to capture @@error at every opportunity in a local variable.
October 31, 2005 at 2:30 pm
Thanks. That was the path I was using, but somehow I had it in my head there was simpler way to handle this...
Oil well. It works...
I wasn't born stupid - I had to study.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply