Home T-SQL stored procedure result into variable
Reply: 0

T-SQL stored procedure result into variable

user541
1#
user541 Published in May 21, 2018, 6:46 pm

I have a stored procedure for some selection in JSON.

CREATE PROC [pr_MySP]
    -- params
WITH ENCRYPTION
AS
BEGIN
    SELECT 
...
    FOR JSON PATH;
END

And now I want to use this stored procedure in another.

CREATE PROC [pr_MySP_1]
    -- params
WITH ENCRYPTION
AS
BEGIN
    DECLARE @result_sp NVARCHAR(MAX);
    EXEC @result_sp = [pr_MySP];
    SELECT @result_sp;
END

But when I try SELECT @result_sp; it return 0. What am I doing wrong?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.3173 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO