Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Get variable values from a stored procedure

$
0
0

I am using SQL 2008R2 and I want to replace a view inside a stored procedure with a new stored procedure to return multiple variable values. Currently I am using the code below to get values for 4 different variables.  I would rather get the 4 variables from a stored procedure (which returns all of these 4 values and more) but not sure how to do so.  Below is the code for getting the 4 variable values in my current sp.

DECLARE @TotalCarb real;
DECLARE @TotalPro real;
DECLARE @TotalFat real;
DECLARE @TotalLiquid real;

SELECT @TotalCarb = ISNULL(TotCarb,0),
	   @TotalPro = ISNULL(TotPro,0),
	   @TotalFat = ISNULL(TotFat,0),
	   @TotalLiquid = ISNULL(TotLiq,0)
  FROM dbo.vw_ActualFoodTotals
 WHERE (MealID = @MealID);


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>