# Rails/MSSQL error

**URL:** <https://www.ruby-forum.com/t/rails-mssql-error/110718>\
**Category:** Rails\
**Created:** [July 30, 2007, 8:04am UTC](https://www.ruby-forum.com/t/rails-mssql-error/110718 "2007-07-30T08:04:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![russel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@russel](https://www.ruby-forum.com/u/russel)\
**Post date:** [July 30, 2007, 8:04am UTC](https://www.ruby-forum.com/t/rails-mssql-error/110718/1 "2007-07-30T08:04:11Z")

</div>

Hi,

I have been encountering this error when I try to save text with  
japanese characters:

DBI::DatabaseError: Execute  
OLE error code:80040E14 in Microsoft OLE DB Provider for SQL Server  
Line 1: Incorrect syntax near ‘20070730’.  
HRESULT error code:0x80020009  
Exception occurred.: INSERT INTO categories ([category\_name],  
[updated\_at], [created\_by], [updated\_by], [description], [created\_at])  
VALUES(‘è²»ç”¨åŒºåˆ†’, ‘20070730 13:57:25’, 1001, 1001, 'Expense ', ‘20070730  
13:57:25’)

I have done all of the thing needed that makes rails support for  
unicode, like installing the unicode\_0.1 gem, adding the $KCODE = ‘u’ in  
the environment.rb and  
in the ApllicationController I have added:

before\_filter :set\_charset

def set\_charset  
@headers[“Content-Type”] = “text/html; charset=utf-8”  
suppress(ActiveRecord::StatementInvalid) do  
ActiveRecord::Base.connection.execute ‘SET NAMES UTF8’  
end  
end

Also I have put encoding: utf8 in my database.yml

But still I get the error.

What am I doing wrong?  
All reply i greatly appreciated. Thanks.
