title: SQL Server Stored Procedure add two declared values for total
body: <p>Here is what I have so far using two declared variables in the stored procedure:</p>
  
  <pre><code>SET @QuestionPoints = (SELECT SUM(points) 
                         FROM   tb_responses 
                         WHERE  userid = @UserId 
                                AND id = @ID) 
  SET @EventPoints =(SELECT SUM(dbo.tb_events.points) 
                     FROM   dbo.tb_attendance 
                            INNER JOIN dbo.tb_events 
                              ON dbo.tb_attendance.eventid = dbo.tb_events.dbid 
                     WHERE  dbo.tb_attendance.userid = @UserID 
                            AND dbo.tb_attendance.didattend = 'Y' 
                            AND dbo.tb_events.id = @ID) 
  </code></pre>
  
  <p>How can I add @QuestionPoints and @EventPoints together to get the total points? Can I just  add them using "+" and assigned to a third declared variable or have one overall statement?</p>
  
  <p>Thanks,</p>
  
  <p>James</p>