December 4, 2008 at 2:50 am
How do we get value in 1x1 table returning from a Stroed Procedure in side a StoredProcedure without using temprery table in main stroed Procedure.
thanks,
Anoop
Please help anybody
December 4, 2008 at 2:58 am
Please can explain in detail and with an example.
December 4, 2008 at 3:04 am
Yes Anoop, please explain it further.
December 4, 2008 at 3:07 am
suppose I have a sp which returns boolean value 0 or 1 how can we get that value in another procedure in which we calling first sp.
December 4, 2008 at 3:13 am
Hi Anoop
You can take the output of calling sp using output parameter. Alternatively you can use udf also.
Thanx
Vaseem
December 4, 2008 at 3:18 am
Sorry i have tryed it is not working.
December 4, 2008 at 3:20 am
Thanks vaseem
grate job!
December 4, 2008 at 3:30 am
Sorry i have tryed it is not working.
Try this code
create proc test
as begin
return 1
end
GO
create proc test1
as begin
declare @a int
execute @a = test
print @a
end
execute test1
Here in the above code test1 sp is calling test sp which returns 1.
test1 sp will get the value 1 and it will print the value.
This is how you can can the sp which is returning a value.
You can also use a output variable to achieve the same thing.
December 4, 2008 at 5:17 am
thanks Gauthama
🙂
December 4, 2008 at 6:25 am
You can also use OUTPUT parameters.
CREATE PROCEDURE proc1
(@param1 INT
,@param2 INT OUTPUT)
AS
SET @param2 = @param1 ;
GO
CREATE PROCEDURE proc2
AS
DECLARE @myparam INT ;
EXEC proc1 @param1 = 42, @param2 = @myparam OUTPUT ;
SELECT @myparam ;
GO
EXEC proc2 ;
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply