title: How to UPDATE #temptable
body: <pre><code>CREATE TABLE #TempProducts (
      Id uniqueidentifier,
      ManufacturerId uniqueidentifier,
      Number varchar(50),
      PresentId uniqueidentifier null)
  </code></pre>
  
  <p>How to UPDATE PresentId field? I have different errors in this:</p>
  
  <p>1) There is already an object named '#TempProducts' in the database.</p>
  
  <pre><code>UPDATE #TempProducts
  SET #TempProducts.PresentId = p.Id
  FROM #TempProducts JOIN Products p ON (#TempProducts.ManufacturerId = p.ManufacturerId AND #TempProducts.Number = p.Number)
  WHERE #TempProducts.Id &lt;&gt; p.Id
  </code></pre>
  
  <p>2) The multi-part identifier "t.PresentId" could not be bound.</p>
  
  <pre><code>UPDATE #TempProducts
  SET t.PresentId = p.Id
  FROM #TempProducts t JOIN Products p ON (t.ManufacturerId = p.ManufacturerId AND t.Number = p.Number)
  WHERE t.Id &lt;&gt; p.Id
  </code></pre>