ClickHouse / ClickHouse/clickhouse-odbc

Convert string to varchar error on mssql linked server

Open
#435 1 comment 0 reactions 0 assignees View on GitHub
MSSQL
Dominant language
C
Stars
285
Forks
105
Avg merge
3h 56m
Merged PRs (30d)
3

Description

Hi,

I downloaded your windows odbc driver from here: https://github.com/ClickHouse/clickhouse-odbc/releases/download/v1.2.1.20220905/clickhouse-odbc-windows.zip

I created linked server on Mssql server using sql server management studion on windows as linked to clickhouse. I run select query on linked server bu I can't get string value. Because mssql server support max 4000 character of string.
I get this error:

"OLE DB provider "MSDASQL" for linked server "CLIKHOUSELINKEDSERVER" returned message "Requested conversion is not supported"
Cannot get the current row value of column "[MSDASQL].Column Name" from OLE DB provider "MSDASQL" for linked server CLIKHOUSELINKEDSERVER".

I want to limit the string value to 4000 characters.
I can get response using this query: SELECT * FROM OPENQUERY([CLICKHOUSEDEMO], 'SELECT toFixedString(namesurname, 100) as namesurname FROM tableCH')

But, I don't want to use toFixedString function. I want to use this query: SELECT namesurname FROM tableCH.

Can I change odbc code to solve this topic and how? Please help me. Thanks.

Contributor guide

Open the contributing guide

Research direction

Start with the Windows ODBC driver version 1.2.1.20220905 and reproduce the linked-server SELECT that fails when returning a long string. Compare the direct column query with the OPENQUERY version using toFixedString, then trace how the driver exposes string columns to MSSQL. Done means the direct SELECT returns a usable value without requiring toFixedString.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.