title: ActiveRecord primary key is a varchar, error when saving
body: <p>I have an active record class</p>
  
  <pre><code>  class Service_Catalogue &lt; ActiveRecord::Base
      set_table_name  "service_catalogue"
      set_primary_key "myKey"
    end
  </code></pre>
  
  <p>myKey is an nvarchar (sql server).</p>
  
  <p>When I try and save it</p>
  
  <pre><code>  service_catalogue= Service_Catalogue.new()
    service_catalogue.myKey = "somevalue"
    service_catalogue.save
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>  IDENTITY_INSERT could not be turned OFF for table [service_catalogue] (ActiveRecord::ActiveRecordError)
  </code></pre>
  
  <p>It seems like ActiveRecord thinks that the primary key is an identity column (it's not its a varchar) and so is failing.</p>
  
  <p>Is there a way to tell it not to try and turn off identity insert?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>It turns out the version of the active record sql server adapter was to blame.
  I had previously been using 1.0.0.9250 but somehow 2.2.19 got installed (I presume when doing a gem update). After reverting to the old version it works fine.</p>