Using Output Variables from One Procedure to Other

  • I just needed a help from you.

    The problem that I am facing is that I am not able to use the output variable of sp_A into sp_b.


    output variable X,

    input variable Y


    Line 1: exec sp_A, @x='',@y='anything'

    Line 2: insert into tab1(id) values (@x)

    i am not able to use @x in line 2 of sp_B.

    Please let me know if this is allowed in SQL Server. And if yes, please let me know how do get around this situation.


    Paras Shah
    Evision Technologies
    Mumbai, India

  • You need to declare the parameter as output, both in the proc and in the code where you call it. Unless the param is declared as output, the 2nd sp will not get the value you're trying to pass to it.


Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply