title: Set Field in One Table Equal To Field In Another on Certain Conditions
body: <p>I am working with a DB in SQL Server 2005 that does not have Unique IDs in the all of the tables that I need them in.  My workaround has been to create a another set of somewhat similar tables with enforced unique IDs.</p>
  
  <p>I want now to carry a reference of the new IDs back to the initial set of tables for Join purposes etcetera.  (Aside: these tables are truncated and repopulated regularly, hence the workaround).</p>
  
  <p>In other words: I want to take IDs in Table2 and properly associate with records in Table1.</p>
  
  <p>The difficult piece for me is that records in Table1 are unique only when three fields are considered.</p>
  
  <p>I added an ID field in Table1, and then I tried the following:</p>
  
  <pre><code>UPDATE dbo.Table1
  
  SET dbo.Table1.ID = dbo.Table2.ID
  
  WHERE dbo.Table1.foo = dbo.Table2.foo
  And dbo.Table1.bar = dbo.Table2.bar
  And dbo.Table1.buzz = dbo.Table2.buzz
  </code></pre>
  
  <p>However, I get the following sort of error:</p>
  
  <pre><code>Msg 4104, Level 16, State 1, Line 1
  The multi-part identifier "dbo.Table2.foo" could not be bound.
  Msg 4104, Level 16, State 1, Line 1
  The multi-part identifier "dbo.Table2.bar" could not be bound.
  Msg 4104, Level 16, State 1, Line 1
  The multi-part identifier "dbo.Table2.buzz" could not be bound.
  </code></pre>
  
  <p>Any thoughts?</p>
  
  <p>Thanks.</p>