hello guys, i have a question about the
limit method as i am having an issue with pagination.
gives this sql command:
... [users].[id] IN (1, 2, 3, 4, 9, 3, 5, 8, 10, 6)
notice that the ID = 3 is used twice.. resulting in incorrect pagination (returning 9 records instead of 10), any help is appreciated on how to fix this.
@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
Device.includes(:health_records).order('health_records.error_number desc').page(1).limit(10).count returns
MyRecord.where(field_name: value).takenow fails with
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 = 1which 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.
["TicketNo", "UniqueID", "ItemNo"]. I can't find an issue or in the code where this should be addressed. any ideas?
orderbut that's kind of a workaround
connectis has the wrong username. There was an
@serverautomatically appended to it. I don't know if that is what the problem might be?
connect server name not founderror. 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.