Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How do i get the value of a return value in a sp ?

Author  Topic 

missMac
Posting Yak Master

124 Posts

Posted - 2009-04-29 : 12:44:37
hello guys,
i have an SP as thus

ALTER procedure [dbo].[prices_calculator]
(
@calculator INT, @return varchar(2000) output


)

.... return @return


If i execute the above sp in another sp or in the query window, how do i get the return value into a variable.

thanks

Skorch
Constraint Violating Yak Guru

300 Posts

Posted - 2009-04-29 : 13:00:43
If I recall correctly you can just do this:

SELECT @YourVariable = [dbo].[prices_calculator] 1 (or whatever other int value you want to pass to the prices_calculator proc)

Some days you're the dog, and some days you're the fire hydrant.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-04-29 : 13:37:13
if you want to retrieve the output variables value outside you can do it like this


DECLARE @RetVal varchar(2000)
EXEC [dbo].[prices_calculator] first value here,@RetVal output
SELECT @RetVal
Go to Top of Page

missMac
Posting Yak Master

124 Posts

Posted - 2009-04-29 : 18:07:21
thanks guys
Go to Top of Page
   

- Advertisement -