@KDGundermann I think the reason is the "includes" vs "left_joins".Device.left_joins(:health_records).order('health_records.error_number desc').page(1).limit(10).count
returns 10
Device.includes(:health_records).order('health_records.error_number desc').page(1).limit(10).count
returns 3
MyRecord.where(field_name: value).take
now fails with ActiveRecord::StatementInvalid
:TinyTds::Error: Invalid column name '"TicketNo", "UniqueID", "ItemNo"'.: EXEC sp_executesql N'SELECT [Tkscale].* FROM [Tkscale] WHERE [Tkscale].[TicketNo] = @0 ORDER BY [Tkscale].["TicketNo", "UniqueID", "ItemNo"] ASC OFFSET 0 ROWS FETCH NEXT @1 ROWS ONLY', N'@0 nvarchar(max), @1 int', @0 = N'10234770', @1 = 1
which is odd since I didn't ask for the ordering. I'm not sure how to fix this. I have set MyRecord.table_name = 'Tkbatch'
and MyRecord.primary_key = :UniqueId
. MyRecord.connection.schema_cache.primary_keys("Tkbatch")
returns ["TicketNo", "UniqueID", "ItemNo"]
. I can't find an issue or in the code where this should be addressed. any ideas?
order
but that's kind of a workaround
connect
is has the wrong username. There was an @server
automatically appended to it. I don't know if that is what the problem might be?
connect server name not found
error. I'm thinking this is just for connecting to a local sql server, and not one that is on a completely different machine. Can anyone point me in the right direction?
Perhaps I'm missing something, is there a way to define an Identity column that is not a primary key?
I am working with a legacy database which has some non-PK identity columns. When a performed a schema dump against our development database nothing seems to indicate that these columns are to be auto incremented.