title: How to Store an Aggregated Value in a Stored Procedure?
body: <p>I am using SQL Server 2012 and trying to write a stored procedure that will have two components:
   1. Select statement that will return several rows
   2. Another component will have an aggregated value based on some conditions.
   So, for the second component, I am thinking to declare a variable in the stored procedure and store the aggregated data there.
  Now, my question is can I populate my output parameter with the data stored in previously declared variable and access the parameter from SSRS 2012?</p>
  
  <p>I would appreciate any suggestion(s) to get me started.</p>
  
  <p>Thank you</p>