title: Row_Number() continue in Union all query
body: <p>How can i get the incremental unique number if i have 3 tables?</p>
  
  <p>for example:</p>
  
  <ul>
  <li>1st query row_number result = 1,2,3</li>
  <li>2nd query row_number result = 4,5,6</li>
  <li>3rd query row_number result = 7,8,9</li>
  </ul>
  
  <p>I tried the below query but from that i can get the incremental upto 2nd table.</p>
  
  <pre><code>SELECT ROW_NUMBER() OVER(ORDER BY filename) AS SrNo,fileName FROM Tab1
  UNION ALL
  SELECT ROW_NUMBER() OVER(ORDER BY filename) + (SELECT COUNT(*) FROM tab1) AS 
  SrNo, filename FROM Tab2
  UNION ALL
  SELECT ROW_NUMBER() OVER(ORDER BY filename) + (SELECT COUNT(*) FROM tab2) AS 
  SrNo, filename FROM Tab3
  </code></pre>
  
  <p>each table has 3 records and i want to get the result of row_number as 1,2,3,4,5,6,7,8,9 </p>