title: Update table with line number using Row_Number() using SQL
body: <p>I have this set of data in the wrntybank_table :</p>
  
  <pre><code>doc_no   doc_lineno  stk_code  stk_lineno  serial_no  warranty_no
  doc1        NULL        ABC         NULL      ABC1       WRN1
  doc1        NULL        ABC         NULL      ABC5       WRN5
  doc1        NULL        DEF         NULL      ABC2       WRN2
  doc2        NULL        ABC         NULL      ABC3       WRN3
  doc4        NULL        HJI         NULL      ABC4       WRN4
  doc4        NULL        HJI         NULL      ABC6       WRN6
  </code></pre>
  
  <p>I want to update this table and filled up doc_lineno &amp; stk_lineno column with number to be like below :</p>
  
  <pre><code>doc_no   doc_lineno  stk_code  stk_lineno  serial_no  warranty_no
  doc1        1        ABC         1      ABC1           WRN1
  doc1        1        ABC         2      ABC5           WRN5
  doc1        2        DEF         1      ABC2           WRN2
  doc2        1        ABC         1      ABC3           WRN3
  doc4        1        HJI         1      ABC4           WRN4
  doc4        1        HJI         2      ABC6           WRN6
  </code></pre>
  
  <p>how to make it using this code for both column.</p>
  
  <pre><code>with toupdate as (
            select Document,
                   10 * row_number() over (partition by Document order by (select NULL)) as val
            from t
           )
  update toupdate
      set line_num = val;
  </code></pre>
  
  <p>note: for doc_lineno, number remain same for same stk_code in the same doc_no and will reset on stk_code and doc_no.
  for stk_lineno, number will reset when diff. stk_code</p>