Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveRecord::StatementInvalid: TinyTds::Error: Incorrect syntax near '0' #843

Open
aet08 opened this issue Aug 9, 2020 · 1 comment
Open

Comments

@aet08
Copy link

aet08 commented Aug 9, 2020

Issue

irb(main):001:0> UserT.count
SQL (4.9ms) USE [GenDB]
(5.5ms) SELECT COUNT(*) FROM [UserT]
=> 2

irb(main):003:0> UserT.first
UserT Load (9.6ms) EXEC sp_executesql N'SELECT [UserT].* FROM [UserT] OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY', N'@0 int', @0 = 1 [["LIMIT", nil]]
ActiveRecord::StatementInvalid: TinyTds::Error: Incorrect syntax near '0'.: EXEC sp_executesql N'SELECT [UserT].* FROM [UserT] OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY', N'@0 int', @0 = 1
from (irb):3

Expected behavior

Should return first record for UserT

Actual behavior

UserT Load (9.6ms) EXEC sp_executesql N'SELECT [UserT].* FROM [UserT] WHERE [UserT].[id] = @0', N'@0 int', @0 = 1 [["id", nil]]
ActiveRecord::StatementInvalid: TinyTds::Error: Invalid column name 'id'.: EXEC sp_executesql N'SELECT [UserT].* FROM [UserT] WHERE [UserT].[id] = @0', N'@0 int', @0 = 1
from (irb):3

How to reproduce

Details

  • Rails version: 5.2.4.3

  • SQL Server adapter version: x.x.x

  • TinyTDS version: x.x.x

  • FreeTDS details:

Compile-time settings (established with the "configure" script)
Version: freetds v1.00.82
freetds.conf directory: /etc/freetds
MS db-lib source compatibility: no
Sybase binary compatibility: yes
Thread safety: yes
iconv library: yes
TDS version: 4.2
iODBC: no
unixodbc: yes
SSPI "trusted" logins: no
Kerberos: yes
OpenSSL: no
GnuTLS: yes
MARS: no


@aidanharan
Copy link
Contributor

Unable to recreate the issue. Could you provide a test case (https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/main/test/cases) or more information on the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants