Rails and MSSQLserver: Anyone had success with Microsoft Sqlserver ?

Al Dev
Fri, 19 Aug 2005 14:40:53 -0000

Does anyone had successful application using Rails and
Microsoft SQLserver? I am having trouble using MS SQLserver
with rails. I tried using ODBC and ADO but both fail. I
am able to do listing but when I click on Edit and save,
 it fails.

But the same application code works just fine with MySQL
(I created identical tables in MySQL and modified
database.yml to point to MySQL).

With MS SQLserver when I click on Edit and save I get this error:

37000 (156) [Microsoft][ODBC SQL Server Driver][SQL Server]
Incorrect syntax near the keyword ''WHERE''.: UPDATE
citrix.sdb_metrics SET  WHERE id_rails = 3

/app/controllers/sdb_metrics_controller.rb:37:in `update''
script/server:49

Request Parameters: {"id_rails"=>"3",
"commit"=>"Edit",
"sdb_metrics"=>{"MAXMETRICVALUE"=>"7366.9482421875",
"id_rails"=>"3",
"METRICDATACOUNT"=>"240",
"STDDEVMETRICVALUE"=>"975.008666992188",
"METRICSAMPLEPERIOD"=>"3600",
"FK_SERVERID"=>"61",
"MINMETRICVALUE"=>"76.5201110839844",
"SERVERUTCBIAS"=>"360",
"FK_SERVERINFID"=>"3",
"FK_METRICID"=>"1",
"MEANMETRICVALUE"=>"355.020080566406",
"METRICUPDATETIME"=>"2005-01-03 04:05:05.0"}}

The sdb_metrics_controller.rb has this - failing at line 37
35  def update
36    @sdb_metrics = SdbMetricsModel.find(params[:id_rails])
37    if @sdb_metrics.update_attributes(params[:sdb_metrics])
38      flash[:notice] = ''SdbMetrics was successfully
updated.''
39      redirect_to :action => ''show'', :id_rails =>
@sdb_metrics
40    else
41      render :action => ''edit''
42    end
43  end

The Show-Framework-trace has this:
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/
active_record/connection_adapters/abstract_adapter.rb:462:in `log''
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/
active_record/connection_adapters/sqlserver_adapter.rb:242:in `execute''
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/
active_record/connection_adapters/sqlserver_adapter.rb:252:in `update''
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/
active_record/base.rb:1145:in `update_without_lock''
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/
active_record/locking.rb:45:in `update_without_callbacks''
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/
active_record/callbacks.rb:274:in `update_without_timestamps''
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/
active_record/timestamp.rb:39:in `update''
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/
active_record/base.rb:1139:in `create_or_update_without_callbacks''
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/
active_record/callbacks.rb:249:in `create_or_update''
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/
active_record/base.rb:965:in `save_without_validation''