-
Notifications
You must be signed in to change notification settings - Fork 565
Closed
Description
I am trying to use execute() to run a query to compute percentages over a partition, so I would like to use connection#execute to run it. However, it returns -1 even though the sql works fine in SQL Server Management Studio.
To eliminate issues from my query, I tried a simple count(*) via the rails console and found that that also returns -1.
Note that I am successfully using sql server in this application without issue, so I am confident in the configuration and setup in general.
Using activerecord-sqlserver-adapter via:
ruby '2.1.1'
gem 'rails', '4.0.4'
gem 'activerecord-sqlserver-adapter', git: 'git://github.com/rails-sqlserver/activerecord-sqlserver-adapter.git'
gem 'tiny_tds'
Given the following class:
class MetricsDatabase < ActiveRecord::Base
establish_connection 'metricsdb'
end
With the following config:
metricsdb:
adapter: sqlserver
host: ******
mode: dblib
dataserver: ******\metricsdb
database: wms
username: *****
password: ******
In the console:
2.1.1 :031 > MetricsDatabase.connected?
=> true
2.1.1 :032 > MetricsDatabase.connection.execute("select count(*) from [metric];")
(64.6ms) select count(*) from [metric];
=> -1
Metadata
Metadata
Assignees
Labels
No labels