Hello everybody,
Thank you for your attention.
I can get numeric data from a linked HP database but unable to pull characte
r type data. Here is the error message:
Server: Msg 7347, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' returned an unexpected data length for the fixed-l
ength column '[].CUSTPART'. The expected data length is 20, while the re
turned data length is 11.
I went thru Microsoft Knowledge Garden but didn't find any satisfactory answ
ers. Your help is greatly appreciated.
WeiHi Wei,
Some 3rd party ODBC drivers behave differently than SQL Server ODBC driver
in the way
they handle fixed length char columns. The difference involves how the
length
indicator value for fixed length columns is handled. If SQL Server ODBC
driver is
being used, the length indicator buffer (last parameter to SQLBindCol) is
always
populated with the max length of the fixed length character column no
matter how
much data is actually in the given data field. The only exception to this
is NULL
values, where the length indicator buffer is populated with the value '-1'.
Some 3rd party ODBC drivers, however, do not take this approach and instead
populate the length indicator buffer with the exact number of bytes of
character
data in the current database field.
To Overcome this, set the trace flag 8765 and you should not face the
problem
To set the flag, in the SQL Server Properties on the General Tab, click on
Startup Parameters and add the new parameter as "-T8765" as one word
without the quotes.
HTH
Ashish
This posting is provided "AS IS" with no warranties, and confers no rights.|||Thank you very much Ashish. It works like magic!! I wish I
had checked your answer earlier.
Wei
>--Original Message--
>Hi Wei,
>Some 3rd party ODBC drivers behave differently than SQL
Server ODBC driver
>in the way
>they handle fixed length char columns. The difference
involves how the
>length
>indicator value for fixed length columns is handled. If
SQL Server ODBC
>driver is
>being used, the length indicator buffer (last parameter
to SQLBindCol) is
>always
>populated with the max length of the fixed length
character column no
>matter how
>much data is actually in the given data field. The only
exception to this
>is NULL
>values, where the length indicator buffer is populated
with the value '-1'.
>Some 3rd party ODBC drivers, however, do not take this
approach and instead
>populate the length indicator buffer with the exact
number of bytes of
>character
>data in the current database field.
>To Overcome this, set the trace flag 8765 and you should
not face the
>problem
>To set the flag, in the SQL Server Properties on the
General Tab, click on
>Startup Parameters and add the new parameter as "-
T8765" as one word
>without the quotes.
>
>HTH
>Ashish
>This posting is provided "AS IS" with no warranties, and
confers no rights.
>.
>
Friday, February 24, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment