Activerecord-sqlserver-adapter nvarchar datatype length

I’ve recently installed this adapter in hope that I can work with utf-8
encoding using the SQL Server nvarchar data type. I’ve installed and
followed the steps detailed at this uri:

I have this following migration class definition:
class CreateContacts < ActiveRecord::Migration
def self.up
create_table :contacts do |t|
t.column :organization_id, :integer, :null=>false
t.column :first_name, :nvarchar, :limit=>10, :null=>false
t.column :last_name, :nvarchar, :null=>false
t.column :title, :string
t.column :contact_type_id, :integer, :null=>false
t.column :fax, :string

def self.down
    drop_table :contacts


When I look at the generated table definition first_name column is
created has a length of 2 rather than 10. In fact all of the columns of
type :nvarchar get a length of 2. If I try what the web site
documentation has, namely:

t.column :body2_utf8, :nvarchar_max # Creates nvarchar(max)
or in my case:
t.column :first_name, :nvarchar_max, :null=>false

I get an error that says:
DBI::DatabaseError: Execute
OLE error code:80040E14 in Microsoft OLE DB Provider for SQL Server
Column, parameter, or variable #3: Cannot find data type
HRESULT error code:0x80020009

Does anyone know how I can set the maximum length of the nvarchar data
type successfully?

Thanks in advance, Calvin.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs