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

MS SQL Server linked server - can't retrieve string attributes #254

fvuksan opened this issue Jul 17, 2019 · 2 comments


Copy link

commented Jul 17, 2019

It seems that string attributes can't be fetched using MSSQL linked server.

Steps to reproduce:

  1. Register Manticore as linked server using ODBC datasource (MySQL ODBC 8.0 Unicode driver).

  2. Manticore query used for retrieving only integer attributes works.
    E.g: SELECT id, id_node_object_type FROM MyIndex

  3. Manticore configuration:
    sql_query = select, cast( as nchar(400)) as folder_name, obj.id_node_object_type from [dbo].[NodeObject]

  4. Manticore queries used for retrieving string attributes:
    SELECT folder_name FROM OPENQUERY([MANTICORE], 'SELECT folder_name FROM MyIndex;')
    SELECT folder_name FROM MANTICORE...MyIndex;
    fails with:
    OLE DB provider 'MSDASQL' for linked server 'MANTICORE' returned data that does not match expected data length for column '[MANTICORE]...[MyIndex].folder_name'. The (maximum) expected data length is 170, while the returned data length is 398.

If I remove cast to nchar from sql_query then I get same error except message ends with "returned data length is 28"

  1. query.log doesn't contain errors:
    /* Wed Jul 17 16:08:42.280 2019 conn 5 real 0.049 wall 0.049 found 2378056 */ SELECT * FROM MyIndex;

Windows 10
Microsoft SQL Server 2017 (RTM-GDR) (KB4494351) - 14.0.2014.14 (X64) Apr 5 2019 09:18:51 Copyright (C) 2017 Microsoft Corporation Developer Edition (64-bit) on Windows 10 Pro 10.0 (Build 17134: )


This comment has been minimized.


This comment has been minimized.

Copy link

commented Jul 24, 2019

I found solution for this. Character set in odbc datasource advanced options should be set to UTF8. This field is empty by deafult.

Like this:


I also tried setting option "Pad CHAR to full length with space" bit that made no difference.

@fvuksan fvuksan closed this Jul 24, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.