0
votes

I'm trying to store file in SQL server using ODBC driver to a column defined as varbinary(max), when I use SQL server driver I get:

the text, ntext, or image pointer value conflicts with the column name specified, the insert/updtae of a text or image column did not succeed

When I use native client driver I get

string data right truncation

Both are symptoms of the same problem well documented in MSDN. Inserting BLOBs bigger than 400kb will trigger this error, any suggested fix!?

Migrating to OleDB is not an option.

The sqlsrv32.dll installed at my machine is, file version: 6.1.7601.17514

1

1 Answers

0
votes

Finally i managed to find the right way, All you have to do is in your 'DoFieldExchange' function is to: m_rgODBCFieldInfos[6].m_nSQLType = -4;

BLOB's are always should be found at the end of your query, so m_rgODBCFieldInfos['x'] refers to your m_nFields-1 location in this array, if you have more than one BLOB you should interrogate which one is which.

In my case this solution solved both exceptions:

  1. from Native Client 11:

    "String data, right truncation."

  2. from SQL Server:

    "the text, ntext, or image pointer value conflicts with the column name specified, the insert/updtae of a text or image column did not succeed"

Cheers :)