title: SQL - Temptable Identity Column not working
body: <p>I created a <code>#TempTable</code>. And reason for creating it is that in the Main table i don't have the Unique column so I am copying data from the <code>Main</code> table into <code>#TempTable</code> with a extra column with Identity.</p>
  
  <pre><code>CREATE TABLE #TEMPTABLE
  (
       rowuniq INT IDENTITY(1,1), 
       [CARDNO] [CHAR](10), 
       [OFFICEPUNCH] [DATETIME]
  );
  
  SET IDENTITY_INSERT #TEMPTABLE ON;
  
  INSERT INTO #TEMPTABLE(rowuniq, CARDNO,OFFICEPUNCH) 
      SELECT CARDNO, OFFICEPUNCH 
      FROM [Tempdata]
  
  SET IDENTITY_INSERT #TEMPTABLE OFF;
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>The select list for the INSERT statement contains fewer items than the insert list. The number of SELECT values must match the number of INSERT columns.</p>
  </blockquote>