Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    29

    Unanswered: Procedure Call / Return

    In a procedure, I want to call another procedure with one parameter and return another parameter.
    How does @out get back to PROC 1?

    --------------

    PROC 1

    exec PROC 2 @in

    END PROC 1


    -----

    PROC 2 @in, @out

    @out = "ABC"

    END PROC 2

  2. #2
    Join Date
    Jun 2004
    Location
    Paris, France
    Posts
    43
    you can do like this :

    create procedure proc2
    @in int,
    @out char(3) output
    as begin
    select @out = case
    when @in < 100 then 'ABC'
    else 'BCD'
    end
    end

    create procedure proc1
    @in int
    as begin
    declare @out char(3)
    exec proc2 @in, @out out

    select @out
    end

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •