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

mssql varbinary(max) fails when selecting data #21

Open
gbwey opened this issue Nov 15, 2015 · 2 comments
Open

mssql varbinary(max) fails when selecting data #21

gbwey opened this issue Nov 15, 2015 · 2 comments

Comments

@gbwey
Copy link

gbwey commented Nov 15, 2015

Hi,
I am getting an "Invalid Descriptor Index" error (as below) when selecting from tables that have varbinary(max) fields.
This used to work about a year ago (not sure if that helps). Anyway here is a small example that fails using HDBC-odbc-2.4.0.1.

Thanks for any help you give me.
Grant

CREATE TABLE [dbo].[testblob]([id] [bigint] IDENTITY%281,1%29 NOT NULL,
[bs1] [varbinary]%28max%29 NULL,
PRIMARY KEY CLUSTERED
%28
[id] ASC
%29)

insert into testblob values(convert(varbinary(max),'xxxxx'))

conn <- H.connectODBC connectionString
stmt1 <- H.prepare conn "select * from testblob"
vals <- H.execute stmt1 []
results <- H.fetchAllRowsAL stmt1
mapM_ print results

*** Exception: SqlError {seState = "["07009"]", seNativeError = -1, seErrorMsg = "sqlGetData: ["0: [Microsoft][ODBC Driver 11 for SQL Server]Invalid Descriptor Index"]"}

@PiotrJustyna
Copy link

I have a similar problem, but with uniqueidentifier.

@PiotrJustyna
Copy link

OK, my issue is now solved. What caused it was the uniqueidentifier but what resolved it was to have the column it represents as the last one in the select statement. Order of columns does not matter in my case.

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

No branches or pull requests

2 participants