title: SQL Server updating new column based on another column from a different table
body: <p>This is my situation:</p>
  
  <p><strong>Hint</strong>: COLUMN (NUMBER_IDENTITY) on 2 tables have the same value but those 2 table have no relationship with each other (this is my choice for my situation)</p>
  
  <p><strong>Early database state</strong></p>
  
  <ul>
  <li>I had table <code>CONTRACTS</code> (ID, NUMBER_IDENTITY, USER_ID)</li>
  <li>I had table <code>SUB_CONTRACTS</code> (ID, NUMBER_IDENTITY)</li>
  </ul>
  
  <p><strong>NOW</strong></p>
  
  <p>I have table <code>CONTRACTS</code> (ID, NUMBER_IDENTITY, USER_ID)</p>
  
  <p>I add new column in <code>SUB_CONTRACTS</code> (ID, NUMBER_IDENTITY, USER_ID)</p>
  
  <p><strong>My problem</strong></p>
  
  <p>I should update <code>USER_ID</code> column in <code>SUB_CONTRACTS</code> with the same value that exists in <code>CONTRACTS</code>. I can do this update because <code>NUMBER_IDENTITY</code> column of the two tables is the same. So <code>SUB_CONTRACT</code> is complementary of <code>CONTRACT</code>.</p>
  
  <p><strong>Question</strong></p>
  
  <p>How to build a function, procedure or query in SQL Server that will solve my problem? Can I make a function that update in the same time all the column that meets this condition? I can solve in mini solution with query but I can't join all this mini query to solve my problem.</p>