I have a problem. I am trying to get a value from stored procedure A into a variable in storded procedure B, kind of like this:
Note: don't be fooled by the simplicity of these samples. There is no other way for me to solve this problem, but to get the value from sp_A into a variable in sp_B, since sp_A is in a database out of my control and i have no clue what happens therein...
CREATE PROCEDURE sp_A
SELECT 'Hello world!'
CREATE PROCEDURE sp_B
DECLARE @Value nvarchar(50)
SET @Value = --** Here i want to get the value from sp_A
Actually, neither works, but thank you for responding.
When i do:
EXEC @MyVariable = MyStoredProcedure
I then want to do:
But in this case, the @MyVariable only holds the value '0' as a code for the result of executing MyStoredProcedure ('0' = no error code returned)
That might work in another context, but i have no control over sp_A. I am not allowed to alter that sp. Actually, all i know is that sp_A is a scalar stored procedure that only returns one value, kind of like: