Skip to content

Linked server using ODBC - Syntax error: Not a valid integer: DC9 #529

@dhanushyaanbalagan-st

Description

@dhanushyaanbalagan-st

Clickhouse ODBC version: clickhouse-odbc-1.4.3-win64.msi

We are using this clickhouse ODBC driver to create Linked server from Microsoft SQL Server (version 2022).

We have a select query that imports data from clickhouse into sql server within a while loop using openquery. The date, col3_int and col4_int values change within the while loop. All columns referred in the query are integers except 1 date column.

And this script randomly fails with error like - [OLE DB provider "MSDASQL" for linked server "pm-clickhouse-etl" returned message "Syntax error: Not a valid integer: xxx".] The xxx varies for each query as shown in below samples. And the same queries works fine when i rerun.

Samples:
select * from openquery([clikchouse-linked-server], 'select col1_int, fact_int from clickhouse_table1 where col1_int < 1000056831 and date=''2025-09-27'' and col3_int =133 and col4_int =191')
Failed with "Syntax error: Not a valid integer: DC9".

select * from openquery([clikchouse-linked-server], 'select col1_int, fact_int from clickhouse_table1 where col1_int < 1054100932 and date=''2025-10-02'' and col3_int =131 and col4_int =16')
Failed with "Syntax error: Not a valid integer: D6A"

ODBC trace log:

1760375440336695 [3664:3944] C:\a\clickhouse-odbc\clickhouse-odbc\source\driver/driver.h:248 in operator (): HY000 (Syntax error: Not a valid integer: CDF)
1760375440338545 [3664:3944] C:\a\clickhouse-odbc\clickhouse-odbc\source\driver\api\odbc.cpp:74 in SQLFreeStmt: SQLFreeStmt option=0
1760375440340968 [3664:3944] C:\a\clickhouse-odbc\clickhouse-odbc\source\driver\api\odbc.cpp:59 in SQLFreeHandle: SQLFreeHandle handleType=3 handle=000001A7AA655BB0
1760375519623125 [3664:5556] C:\a\clickhouse-odbc\clickhouse-odbc\source\driver\api\odbc.cpp:790 in SQLDisconnect: SQLDisconnect
1760375519623172 [3664:5556] C:\a\clickhouse-odbc\clickhouse-odbc\source\driver\api\odbc.cpp:59 in SQLFreeHandle: SQLFreeHandle handleType=2 handle=000001ABB5ED81F0
1760375519623196 [3664:5556] C:\a\clickhouse-odbc\clickhouse-odbc\source\driver\api\odbc.cpp:59 in SQLFreeHandle: SQLFreeHandle handleType=1 handle=000001A7A7605FB0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions