Thursday 5 January 2012

Best way to assign the return value of Store Proceudre to a variable in Sql

I have a stored procedure that returns a valueI call it from other stored procedures that need to retrieve this value. 
 
DECLARE @localVariable INT
EXEC    @localVariable = GetMyValue
SELECT  @localVariable
DECLARE @localVariable INSERT @localVariable = (SELECT TOP 1 newvalue FROM @tmpNewValue)