title: SQL Server - Autoincrementing on a generated table
body: <p>Here's what I'm trying to do:</p>
  
  <pre><code>SELECT * INTO new_table FROM old_table WHERE 1=2;
  ALTER TABLE new_table ADD CONSTRAINT pk_new_table_id PRIMARY KEY(id);
  SET IDENTITY_INSERT new_table ON
  </code></pre>
  
  <p>Basically, I want to create a new table based on the structure of an existing one, then turn on autoincrementing for the ID field. However, when I try to insert rows I get this:</p>
  
  <pre><code>Table 'new_table ' does not have the identity property. Cannot perform SET operation.
  </code></pre>
  
  <p>Can anyone enlighten me as to what I'm doing wrong or how I should actually be going about this?</p>