Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Best practice for procedures calling other procedures - chain them or call them all from one parent?

$
0
0

I am dealing with a situation that involves one procedure that calls another procedure which in turn calls another which...you get the idea.  The chain is about 5 long.  Yes its ugly and I want to rewrite them or consolidate the mess.

This got me to thinking how to better control the "flow" of something like this.  So instead of something like this

(call sequence)
A > B > C > D > E

do this instead
start transaction
A > B
...check return code
A > C
...check return code
A > D
...check return code
A > E
...check return code

if return code(s) ok, then return success to caller, otherwise handle error message etc

Thoughts?


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>