title: Temp Table collation conflict - Error : Cannot resolve the collation conflict between Latin1* and SQL_Latin1*
body: <p>I can't update temp table. This is my query</p>
  
  <pre><code>CREATE TABLE #temp_po(IndentID INT, OIndentDetailID INT, OD1 VARCHAR(50), OD2 VARCHAR(50), 
          OD3 VARCHAR(50), ORD VARCHAR(50), NIndentDetailID INT, ND1 VARCHAR(50), ND2 VARCHAR(50), 
          ND3 VARCHAR(50), NRD VARCHAR(50), Quantity DECIMAL(15,3))
  
          INSERT INTO #temp_po(IndentID, OIndentDetailID, OD1, OD2, OD3, ORD)
          SELECT ID.IndentID, ID.IndentDetailID, ID.D1, ID.D2, ID.D3, ID.RandomDimension 
          FROM STR_IndentDetail ID WHERE ID.IndentID = @IndentID
  
          UPDATE 
              t 
          SET
              t.ND1 = CASE WHEN D.D1 = '' THEN NULL ELSE D.D1 END,
              t.ND2 = CASE WHEN D.D2 = '' THEN NULL ELSE D.D2 END,
              t.ND3 = CASE WHEN D.D3 = '' THEN NULL ELSE D.D3 END,
              t.NRD = CASE WHEN D.RandomDim = '' THEN NULL ELSE D.RandomDim END,
              t.Quantity = D.PurchaseQty
          FROM
              #temp_po t INNER JOIN @detail D ON D.IndentDetailID = t.OIndentDetailID
          WHERE
              t.IndentID = @IndentID
  </code></pre>
  
  <p>But it gives the error</p>
  
  <blockquote>
    <p>Cannot resolve the collation conflict between "Latin1_General_CI_AI" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.</p>
  </blockquote>
  
  <p>How to resolve this problem?</p>
  
  <p>My <code>tempdb</code> collation is <code>Latin1_General_CI_AI</code> and my actual database collation is <code>SQL_Latin1_General_CP1_CI_AS</code>.</p>