title: What is the correct type for @@ROWCOUNT?
body: <p>I am writing a stored procedure in SQL Server 2008 and I need to count the rows affected by a query.</p>
  
  <pre><code>DECLARE
      @my_rows                    AS INT
  </code></pre>
  
  <p>and then</p>
  
  <pre><code>SELECT *
  FROM a table
  WHERE some conditions
  SET @my_rows=@@ROWCOUNT
  </code></pre>
  
  <p>if I declare my_rows as varchar it works correctly but if I declare as INT I get the following error:</p>
  
  <blockquote>
    <p>Arithmetic overflow error converting expression to data type tinyint.</p>
  </blockquote>
  
  <p>What is the correct type to declare? I think that the numer of rows could only be integer and betweeb 0 and the total numer of rows.</p>