title: Append the rowNumber() with max value in sql server
body: <p>Hi I am working on a requirement where I am using rownumber() function to get the linenumbers it is working fine when I insert the first batch of the rows in a file but the issue is when I insert the new batch with same Id, the line number is starting from 1. I want to continue from the max value of the Id as below</p>
  
  <p>For First Batch of rows insertion</p>
  
  <pre><code>OrderID   Row#   ConfirmationID
  ---------  ----  -------------
  258584048   1   285477904
  258584048   2   285477905
  258584048   3   285477907
  258584048   4   285477908 
  </code></pre>
  
  <p>For Secon Batch of rows insertion again it is starting from 1</p>
  
  <pre><code>OrderID   Row#   ConfirmationID
  ---------  ----  -------------
  258584048   1   285477911
  258584048   2   285477912
  258584048   3   285477913
  258584048   4   285477914
  </code></pre>
  
  <p>I am expecting the result as below </p>
  
  <pre><code>OrderID   Row#   ConfirmationID
  ---------  ----  -------------
  
  258584048   1   285477904
  258584048   2   285477905
  258584048   3   285477907
  258584048   4   285477908 
  258584048   5   285477911
  258584048   6   285477912
  258584048   7   285477913
  258584048   8   285477914
  
  row_number() over(PARTITION BY OrderID order by OrderID)
  </code></pre>