I have a stored procedure say @Create_Dummy1
which is being passed a variable. This is declared as @Dummy_Variable1
in this stored procedure.
Next I need to call another stored procedure @Create_Dummy2
from @Create_Dummy1
. I need to pass @Dummy_Variable1
in the exec
statement.
But if I try to do this the string @Dummy_Variable1
is only being passed instead of the value it holds.
I'm executing procedures inside other procedures like this:
DECLARE @childResult int, @loaErrorCode int, @loaErrorMessage varchar(255)
EXEC @childResult = [dbo].[proc_sub_getSomething] @schemes_id = @foo_schemes_i, @errorCode = @loaErrorCode OUTPUT , @errorMessage = @loaErrorMessage OUTPUT
Should it still not work you should edit your question to show your exact code.
This should work:
create procedure Create_Dummy1
(
@Dummy_Variable1 int
)
as
exec Create_Dummy2 @Dummy_Variable1
Go
And
create procedure Create_Dummy2
(
@Dummy_Variable1 int
)
as
Select * From yourTable WHERE tableColumn = @Dummy_Variable1
And this is how you call it:
exec Create_Dummy1 1
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With