Skip to content

TinyTDS syntax error (where infact there is no error in its generated SQL syntax) #35

@ata-n

Description

@ata-n

I am using TinyTDS to connect to a remote SQL Server (2005), everything works fine except when I do an UPDATE.
Actually the UPDATE works fine too, but it raises an exception regardless. I can see the updated field when I view the record, but right after the update is finished I get the following exception :

ActiveRecord::StatementInvalid (TinyTds::Error: Incorrect syntax near the keyword 'and'.: UPDATE [surveys] SET [Other CD Type] = N'' WHERE [surveys].[id] = 24):

TOP OF THE TRACE

activerecord (3.0.9) lib/active_record/connection_adapters/abstract_adapter.rb:207:in log' activerecord-sqlserver-adapter (3.0.15) lib/active_record/connection_adapters/sqlserver/database_statements.rb:228:indo_execute'
activerecord-sqlserver-adapter (3.0.15) lib/active_record/connection_adapters/sqlserver/database_statements.rb:19:in execute' activerecord-sqlserver-adapter (3.0.15) lib/active_record/connection_adapters/sqlserver/database_statements.rb:211:inupdate_sql'
activerecord (3.0.9) lib/active_record/connection_adapters/abstract/database_statements.rb:49:in update' activerecord (3.0.9) lib/active_record/connection_adapters/abstract/query_cache.rb:16:inupdate'
arel (2.0.10) lib/arel/crud.rb:20:in update' activerecord (3.0.9) lib/active_record/persistence.rb:259:inupdate'

I can easily verify that there is no syntax error, and in fact it does update the required field in the desired record; however this exception is thrown anyway. I tried disabling activerecord logging but no help. The exception is telling me about a keyword that doesn't even exist in the generated SQL statement.

Thanks very much in advance,

Specs

Platform: Mac OS X Snow Leopard
Ruby 1.8.7
Rails 3.0
freetds 0.8.2
SQL Server 2005 is remote on Windows 2003 Server

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions