title: SUM function does not return decimal
body: <p>I need your help:</p>
  
  <p>I want to get the SUM of the the Amount field, it contains decimal values but I get just the <code>INTEGER</code> part and I need the <code>DECIMAL</code> too:</p>
  
  <pre><code>DECLARE @TOTAL AS DECIMAL(13,2)
  
  SET @Total = (SELECT SUM(Amount)
                FROM t_DownPmtTrans
                WHERE MortgageID = @MortgageID 
                  AND DatePaid IS NULL 
                  AND SchedPayment IS NOT NULL)
  </code></pre>
  
  <p>I have tried with a CURSOR but I get the same:</p>
  
  <pre><code>OPEN dpt_cursor 
  SET @Total= 0.0
  
  FETCH NEXT FROM dpt_cursor INTO @DownPmtTransID, @Amount
  
  WHILE @@FETCH_STATUS= 0 
  BEGIN
  
     PRINT @Amount
     SET @Total = (@Total + @Amount)
  
     FETCH NEXT FROM dpt_cursor
       INTO @DownPmtTransID, @Amount
  END 
  
  RETURN  @Total* (-1)
  CLOSE dpt_cursor 
  DEALLOCATE dpt_cursor
  </code></pre>
  
  <p>Thanks!!</p>