[freetds] VARCHAR values > 8000 bytes truncated (db-lib)

Frediano Ziglio freddy77 at gmail.com
Wed Dec 23 05:06:10 EST 2015


Il 11/Dic/2015 13:12, "Joshua Lang" <joshua.h.lang at gmail.com> ha scritto:
>
> When trying to pass stored procedure VARCHAR(MAX) parameters (using
> SYBVARCHAR for the parameter type), the value is truncated at 8000. This
is
> due to the `tds_fix_column_size` method limiting the value to 8000 because
> the `column_varint_size` of the column == 2.
>
> Based on the comment in `tds_fix_column_size` (src/tds/query.c), it seems
> as if this is unexpected:
>
>     /* note that varchar(max)/varbinary(max) have a varint of 8 */
>
> The comment above indicates that this should be supported. Am I missing
> something or using the db-lib API incorrectly? My code is working fine
> otherwise.
>
>
>
>
> freetds: 0.95.73
> OS: Ubuntu 14.04
> DB: MS SQL Server 2008 SP3
> TDS: 7.3
>
> Thanks
>
Hi,
  Varchar(max) is more similar to text than to normal varchar so type is
not promoted. I  don't remember if text is promoted to varchar(max) under
dblib.

Frediano


More information about the FreeTDS mailing list