title: Adding a unique ID number to a difference of tables
body: <p>I'm using this query to find the difference in rows between 2 different databases (A and B) on the same table that I need to insert into B :</p>
  
  <pre><code>(select recordkey, class, relatedreckey, relatedrecclass, relatetype
  from A.dbo.relatedrecord
  group by recordkey, class, relatedreckey, relatedrecclass, relatetype)
  EXCEPT
  (select recordkey, class, relatedreckey, relatedrecclass, relatetype
  from B.dbo.relatedrecord
  group by recordkey, class, relatedreckey, relatedrecclass, relatetype)
  </code></pre>
  
  <p>The problem I'm facing now is that there is a unique id column called RELATEDRECORDID that I need to populate in a sequence (max(B.dbo.relatedrecordid)+1) for each of those result rows.</p>
  
  <p>How can I include this unique ID generation in the original query?</p>