title: Integer to guid primary key database migration
body: <p>I'm trying to migrate from int based primary keys to guid based system, and I'm having trouble with migrating self referenced table</p>
  
  <pre><code>Entity
  ---------
  ID
  ParentID
  AnotherParentID
  </code></pre>
  
  <p>When querying the table I'm creating new guid <code>ID</code> for each row, but how can I set that same guid value for rows that have  that <code>ID</code> as foreign key on <code>ParentID</code> or <code>AnotherParentID</code> fields?</p>
  
  <pre><code>SELECT 
      newid() as ID,
      (SELECT e.ID ...?) as ParentID,
      (SELECT e.ID ...?) as AnotherParentID,
  FROM Entity e
  </code></pre>