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

Query now too long? #259

Closed
JockLawrie opened this issue Apr 3, 2020 · 2 comments
Closed

Query now too long? #259

JockLawrie opened this issue Apr 3, 2020 · 2 comments

Comments

@JockLawrie
Copy link

Hi there,

I am extracting data from a SQL Server instance.
I'm running Julia 1.4.0 on Windows 10 with ODBC.jl v0.8.1.
The error is below.
I have been running this query without issue on another machine, which I no longer have access to.
Other than breaking the query up into pieces, is there something else I can do?

[ODBC] 42000: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]The identifier that starts with 'select EventId, HospitalAdmission, HospitalEmergency, OnsetMinutes as TimeToOnset, SymptomsPersistedMinutes as SymptomDuration,
' is too long. Maximum length is 128.
ERROR: ODBC.ODBCError("API.SQLExecDirect(stmt, query) failed; return code: -1 => SQL_ERROR")
Stacktrace:
 [1] macro expansion at C:\Users\Owner\.julia\packages\ODBC\KFiOK\src\ODBC.jl:57 [inlined]
 [2] ODBC.Query(::ODBC.DSN, ::String) at C:\Users\Owner\.julia\packages\ODBC\KFiOK\src\Query.jl:47
 [3] query(::ODBC.DSN, ::String, ::Type{DataFrames.DataFrame}; weakrefstrings::Bool, append::Bool, transforms::Dict{Int64,Function}) at C:\Users\Owner\.julia\packages\ODBC\KFiOK\src\Query.jl:278
 [4] query at C:\Users\Owner\.julia\packages\ODBC\KFiOK\src\Query.jl:273 [inlined]
 [5] query at C:\Users\Owner\.julia\packages\ODBC\KFiOK\src\Query.jl:264 [inlined]
 [6] fetch_data(::Saefvic.config.SafeVacConfig) at C:\Data\ScheduledTasks\SAEFVIC_ETL\Saefvic.jl\src\fetchdata.jl:19
 [7] main(::String) at C:\Data\ScheduledTasks\SAEFVIC_ETL\Saefvic.jl\src\run.jl:23
 [8] top-level scope at REPL[7]:1
@quinnj
Copy link
Member

quinnj commented May 1, 2020

Hmmmm, something funny is going on. identifier in SQL is usually a single entity name: column, table, database, etc. So the fact that it's saying the select EventId... is all one identifier makes me wonder if you have double quotes around that whole string? Maybe there's some inadvertent quote interpolation going on? Can you double check your query to make sure you don't have misplaced double quotes?

@quinnj
Copy link
Member

quinnj commented May 23, 2020

Please comment/reopen if it's still an issue.

@quinnj quinnj closed this as completed May 23, 2020
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