title: Cannot insert explicit value for identity column in table when IDENTITY_INSERT is set to OFF
body: <p>I'm trying to insert records in a table that has got an identity column.  For various reasons, this should not be a straight insert, but it should have the same ID as the foreign table.
  So I run:</p>
  
  <pre><code>EXECUTE ('SET IDENTITY_INSERT RemoteDB.dbo.FrameContent ON')
  
  INSERT INTO [RemoteDB].[dbo].[FrameContent] ([ID],[FrameID],[PacketType]) 
  SELECT [ID],[FrameID],[PacketType]
  FROM FrameContent 
  WHERE [ID] NOT IN (SELECT [ID] FROM [RemoteDB].[dbo].[FrameContent])
  </code></pre>
  
  <p>And I get the error:</p>
  
  <pre><code>Cannot insert explicit value for identity column in table 'FrameContent' when IDENTITY_INSERT is set to OFF.
  </code></pre>
  
  <p>Any ideas? It complains that IDENTITY_INSERT should not be OFF, but I am setting it to ON. </p>