Passing Variables Between Stored Procedures

  • Has anyone ever passed variables between stored procedures. I looked at BOL and so far I have not found anything of use.

    Thanks

     

  • 2 ways of doing this :

    1-

    create myproc2 @somevariable as int

    as

    select 1

    go

    Create myproc1

    as

    set @somevariable = 3

    exec myproc2 @somevariable

    go

    2-

    Create myproc1 @SomeVariable int output

    as

    set @somevariable = 3

    go

    create myproc2 @SomeVariable int

    as

    select 1

    go

    declare @var int

    exec myproc1 @var output

    exec myproc2 @var

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

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