Hi, iam facing the error microsoft odbc driver 17 for sql server string data right truncation when trying to perform insert query in column which is varbinary(max)

Harinkhede, Bhavna 0 Reputation points
2023-11-12T08:42:05.8633333+00:00

development work in C++ builder 2007

and using SSMS 19 SQL server 2022

DSN ODBC DRIVER 17 FOR SQL SERVER

my connectionstring

ConnectionString=Provider="MSDASQL.1";Persist Security Info="False";Data Source="ODBC17Setup";Initial Catalog="DB"

IN DB the column in which i am performing insert operation is Varbinary(max)

in c++ builder 2007 we are managing this data using Blob and also there is no issue if provider is SQLNCLI11 and in DataSource we are passing sql server name only issue is when connecting is using above mentioned connection string

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,827 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Harinkhede, Bhavna 0 Reputation points
    2023-11-15T05:18:06.82+00:00

    also i was going through this link https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/known-issues-in-this-version-of-the-driver?view=sql-server-ver16#next-steps

    f the client encoding is UTF-8, the driver manager doesn't always correctly convert from UTF-8 to UTF-16. Currently, data corruption occurs when one or more characters in the string aren't valid UTF-8 characters. ASCII characters are mapped correctly. The driver manager attempts this conversion when calling the SQLCHAR versions of the ODBC API (for example, SQLDriverConnectA). The driver manager won't attempt this conversion when calling the SQLWCHAR versions of the ODBC API (for example, SQLDriverConnectW).

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.