How to take an return value of one sp as the input to another sp ?

Posted by Mahendrabasutkar under Sql Server on 9/10/2011 | Points: 10 | Views : 1086 | Status : [Member] | Replies : 1
Hi All,

How to take an return value of one sp as the input to another sp ?
Please provide with code if possible.

Thanks&Regards,
mahendrabasutkar




Responses

Posted by: Hmanjarawala on: 9/11/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi mahendra,
as per my knowledge sp doesn't return any thing, but yes you can return value through output variable
here is a code:

Create Procedure sp_Source
@para1 int,
@para2 varchar(max) output
as
begin
................
--Here is some code
SET @para2 = <value>
end;

Create procedure sp_destination
as
begin
Declare @input1 int
Declare @Output varchar(max)
call sp_source @input1, @output
...............
end

in destination procedure you can use @output for further use.

Hope this code will helps you, if so plz marked this as reply

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Mahendrabasutkar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response