title: Moving duplicate record to another table before deleting
body: <p>I found this great code which deletes duplicate rows in a SQL Server table.</p>
  
  <pre><code>;WITH x AS 
  (
    SELECT col1, col2, col3, rn = ROW_NUMBER() OVER 
        (PARTITION BY col1, col2, col3 ORDER BY id)
    FROM dbo.tbl
  )
  DELETE x WHERE rn &gt; 1;
  </code></pre>
  
  <p>Now I want to <strong>move the duplicate records to another table before deleting</strong>. Any help would be really appreciated. Thanks.</p>