We’ve got a stored procedure we call to create a user. Within that stored procedure we call other stored procedures to create things the user needs to start off with. Each of the stored procedures end with something like this:
select 1 AS statusMsg, 'User Successfuly Created' as msg;
The problem is that we’re getting the wrong statusMsg and msg back.
We end the procedure with:
call createDefaultSites(l_customerguid);
select 1 AS statusMsg, 'User Successfuly Created' as msg;
But we’re getting back the statusMsg and msg from the createDefaultSites() call instead of the final select.
How can we ensure that only the last statement returns a result?
I wound up adding an identifier to each return value and looping through them to find the one I was looking for.
I honestly didn’t realize I was getting back multiple result sets. If the statusMsg would’ve been from the first result set I maybe would’ve figured it out a little quicker.