I'm using the Microsoft ODBC Desktop Database Drivers to create an excel (xlsb) file from my application. I made various attempts to create a text column with more than 255 characters. But either the text is truncated to 255 characters or I'm getting an error. Do you know how to use the driver to make a text column with more characters?
My attempts so far:
- Calling
SQLExecDirect
withCREATE TABLE [Test] ([TestCol] TEXT (1000))
results in the error:SQLSTATE = 37000
;Size of field 'TestCol' is too long
CREATE TABLE
without(1000)
and callingSQLBindParameter
with aNULL
terminated string with more than 255 characters and aColumnSize
argument with the value 0 results in an excel sheet where the column is truncated.- Like 2. but with a
ColumnSize
with the length of the string results in the error:SQLSTATE = S1104
;Invalid Precision Value
.
The connection is opened with the connection string Driver="{Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)}; DBQ=C:\Temp\test.xlsb; FIL={excel 12.0 xml};DriverID=1046;ReadOnly=False"
All the links and Workarounds about the truncation to 255 characters I found so far (e.g. Data truncated to 255 characters with Excel ODBC driver) are about reading an excel worksheet. I like to write data.