[freetds] freetds silently truncating text/varchar/etc fields to 80 characters

James K. Lowden jklowden at freetds.org
Sun May 3 17:15:11 EDT 2009

Federico Alves wrote:
> I have the same issue win SQL 2008 and tds version=8.0.  I cannot
> retrieve a column whose varchar(length) is longer than a few spaces,
> maybe 80, have not measured it, but of it goes past a threshold, I get
> nothing at all. 

$  TDS=8.0 sqsh -S$S -m bcp -U$U -P$P -C \
"select top 1  datalength(text) as nbytes, text from syscomments where
datalength(rtrim(text)) > 200" 

sqsh-2.1.5 Copyright (C) 1995-2001 Scott C. Gray
4136|create procedure sys.sp_MSalreadyhavegeneration
    (@genguid uniqueidentifier, 
     @subscribernick binary(6),
     @compatlevel int = 10) -- backward compatibility level,

    declare @nicknames varbinary(1000)
    declare @offset int
    declare @retcode int
    declare @dbname sysname

It must be something more specific than that.  sqsh uses ct-lib and can
readily retrieve wide text columns.  The above query returned 4136 bytes. 


More information about the FreeTDS mailing list