title: Insert from temporary table adding identity
body: <p>I have imported in a temporary table several rows from a csv file using bulk insert on SQL Server. I had to import on a temp table because the primary key ID was not present in the CSV file. </p>
  
  <p>Now I would like to transfer the data on the real table; but I can't because I  can't find the way to add the id.</p>
  
  <p>I have tried:</p>
  
  <pre><code>INSERT INTO companies (id, code, name, vat_code, ce_vat_code, fiscal_code, 
      address, zip_code)
  SELECT IDENTITY(INT) AS id, code, name, vat_code, ce_vat_code, 
      fiscal_code, address, zip_code
  FROM   temp_companies
  </code></pre>
  
  <p>but I get this error:</p>
  
  <pre><code>The IDENTITY function can only be used when the SELECT statement has an INTO 
  clause.
  </code></pre>