Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
sbobba
Frequent Visitor

Custom Connector ODBC - Conversion error from string to varchar

Hi 

 

I have a custom connector written for ODBC to enable direct query in Power BI. When I am testing it out I am running it into below error - 

 

SimpleDocumentEvaluator/GetResult/Evaluate {"Start":"2020-02-06T16:25:54.9123041Z","Action":"SimpleDocumentEvaluator/GetResult/Evaluate","HostProcessId":"25832","ProductVersion":"2.76.5678.782 (19.12)","ActivityId":"81cf1593-40cd-45af-9327-2d08dd8a8689","Process":"Microsoft.Mashup.Container.NetFX45","Pid":22924,"Tid":1,"Duration":"00:00:00.1040025"}
OdbcQuery/FoldingWarning {"Start":"2020-02-06T16:25:55.0300042Z","Action":"OdbcQuery/FoldingWarning","HostProcessId":"25832","Function Name":"AdjustForCompatibility","ProductVersion":"2.76.5678.782 (19.12)","ActivityId":"81cf1593-40cd-45af-9327-2d08dd8a8689","Process":"Microsoft.Mashup.Container.NetFX45","Pid":22924,"Tid":1,"Duration":"00:00:00.0000173"}
OdbcQuery/FoldingWarning {"Start":"2020-02-06T16:25:55.0303225Z","Action":"OdbcQuery/FoldingWarning","HostProcessId":"25832","ErrorMessage":"Failed to convert type string to varchar, expression `OTBL`.`sgmtl_rptg_cd` to `ITBL`.`sgm_cd`.","ProductVersion":"2.76.5678.782 (19.12)","ActivityId":"81cf1593-40cd-45af-9327-2d08dd8a8689","Process":"Microsoft.Mashup.Container.NetFX45","Pid":22924,"Tid":1,"Duration":"00:00:00.0015620"}
OdbcQuery/FoldingWarning {"Start":"2020-02-06T16:25:55.0319004Z","Action":"OdbcQuery/FoldingWarning","HostProcessId":"25832","Function Name":"AdjustTextValuesForCompatibility","ProductVersion":"2.76.5678.782 (19.12)","ActivityId":"81cf1593-40cd-45af-9327-2d08dd8a8689","Process":"Microsoft.Mashup.Container.NetFX45","Pid":22924,"Tid":1,"Duration":"00:00:00.0000102"}
OdbcQuery/FoldingWarning {"Start":"2020-02-06T16:25:55.0319192Z","Action":"OdbcQuery/FoldingWarning","HostProcessId":"25832","Function Name":"ConvertForSize","ProductVersion":"2.76.5678.782 (19.12)","ActivityId":"81cf1593-40cd-45af-9327-2d08dd8a8689","Process":"Microsoft.Mashup.Container.NetFX45","Pid":22924,"Tid":1,"Duration":"00:00:00.0000053"}
OdbcQuery/FoldingWarning {"Start":"2020-02-06T16:25:55.0319321Z","Action":"OdbcQuery/FoldingWarning","HostProcessId":"25832","Function Name":"Convert","ProductVersion":"2.76.5678.782 (19.12)","ActivityId":"81cf1593-40cd-45af-9327-2d08dd8a8689","Process":"Microsoft.Mashup.Container.NetFX45","Pid":22924,"Tid":1,"Duration":"00:00:00.0000045"}
OdbcQuery/FoldingWarning {"Start":"2020-02-06T16:25:55.0322693Z","Action":"OdbcQuery/FoldingWarning","HostProcessId":"25832","ErrorMessage":"Failed to convert from string to string for expression `OTBL`.`sgmtl_rptg_cd`. You can override this by using SqlGetInfo for converting from WVARCHAR to WLONGVARCHAR.","ProductVersion":"2.76.5678.782 (19.12)","ActivityId":"81cf1593-40cd-45af-9327-2d08dd8a8689","Process":"Microsoft.Mashup.Container.NetFX45","Pid":22924,"Tid":1,"Duration":"00:00:00.0004697"}
OdbcQueryDomain/ReportFoldingFailure {"Start":"2020-02-06T16:25:55.0333843Z","Action":"OdbcQueryDomain/ReportFoldingFailure","HostProcessId":"25832","Exception":"Exception:\r\nExceptionType: Microsoft.Mashup.Engine1.Runtime.FoldingFailureException, Microsoft.MashupEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\r\nMessage: Folding failed. Please take a look the information in the trace.\r\nStackTrace:\n at Microsoft.Mashup.Engine1.Library.Odbc.OdbcQueryExpressionVisitor.Convert(OdbcTypeInfo typeInfo, OdbcScalarExpression expression)\r\n at Microsoft.Mashup.Engine1.Library.Odbc.OdbcQueryExpressionVisitor.ConvertForSize(OdbcScalarExpression left, OdbcScalarExpression right, Int32 size, Boolean fallbackToLargestType)\r\n at Microsoft.Mashup.Engine1.Library.Odbc.OdbcQueryExpressionVisitor.AdjustTextValuesForCompatibility(OdbcScalarExpression left, OdbcScalarExpression right)\r\n at Microsoft.Mashup.Engine1.Library.Odbc.OdbcQueryExpressionVisitor.AdjustForCompatibility(OdbcScalarExpression left, OdbcScalarExpression right, Precision precision)\r\n at Microsoft.Mashup.Engine1.Library.Odbc.OdbcQueryExpressionVisitor.VisitEquals(OdbcSqlExpression leftExpression, OdbcSqlExpression rightExpression, Precision precision, Boolean nullable)\r\n at Microsoft.Mashup.Engine1.Library.Odbc.OdbcQueryDomain.OdbcOptimizingQueryVisitor.VisitJoinCore(JoinQuery joinQuery)\r\n at Microsoft.Mashup.Engine1.Library.Odbc.OdbcQueryDomain.OdbcOptimizingQueryVisitor.VisitJoin(JoinQuery joinQuery)\r\n\r\n\r\n","ProductVersion":"2.76.5678.782 (19.12)","ActivityId":"81cf1593-40cd-45af-9327-2d08dd8a8689","Process":"Microsoft.Mashup.Container.NetFX45","Pid":22924,"Tid":1,"Duration":"00:00:00.0082509"}

 

I have tried to overwrite SQL_CONVERT_WVARCHAR and SQL_CONVERT_WLONGVARCHAR, but I'm still seeing this error. Below is my SQLGetInfo. 

 

 

 

           SQLGetInfo = [
                // SQLGetinfo Overrides: https://docs.microsoft.com/en-us/power-query/odbc#overriding-sqlgetinfo
                SQL_AGGREGATE_FUNCTIONS = 0x0000007F,
                SQL_CONVERT_BIGINT = 0x000273D8,
                SQL_CONVERT_BIT = 0x000273D8,          
                SQL_CONVERT_FUNCTIONS = 0x00000003,
                SQL_CONVERT_INTEGER = 0x000273D8,
                SQL_CONVERT_LONGVARCHAR = 0x000273D8,
                SQL_CONVERT_REAL = 0x000273D8,
                SQL_CONVERT_SMALLINT = 0x000273D8,
                SQL_CONVERT_TIMESTAMP = 0x00023318,
                SQL_CONVERT_TINYINT = 0x000273D8,
                SQL_CONVERT_VARCHAR = 0x000273D8,
                SQL_CONVERT_WLONGVARCHAR = 0x000C273D8,
                SQL_CONVERT_WVARCHAR = 0x000C273D8,
                SQL_IDENTIFIER_QUOTE_CHAR = "`",
                SQL_GROUP_BY = 2,
                SQL_NUMERIC_FUNCTIONS = 0x007FFFEF,
                SQL_SCROLL_OPTIONS = 0x00000011,
                SQL_SQL_CONFORMANCE = 8,
                SQL_SQL92_DATETIME_FUNCTIONS = 0x00000007,
                SQL_SQL92_PREDICATES = 0x00001E07,
                SQL_SQL92_RELATIONAL_JOIN_OPERATORS = 0x00000158,
                SQL_SQL92_STRING_FUNCTIONS = 0x00000009,
                SQL_SQL92_VALUE_EXPRESSIONS = 0x00000007,
                SQL_STRING_FUNCTIONS = 0x00053FFF,
                SQL_SYSTEM_FUNCTIONS = 0x00000006,
                SQL_TIMEDATE_FUNCTIONS = 0x001E7FE7
            ],

 

 

 

Can any one help me out figuring this error and how to resolve it? Thanks for the help

 

 

0 REPLIES 0

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.