[freetds] Weird problem with CHAR columns being reported as VARCHAR columns with FreeTDS 0.61.2, DBD::ODBC and unixODBC and iODBC talking to SQL Server 2000, perl 5.8.1 on Solaris

Harrington, Paul Paul-Harrington at deshaw.com
Mon Oct 13 14:30:09 EDT 2003


Hi,
I thought that I was having problems with the ChopBlanks attribute being honored in DBD::ODBC as any of my tests with CHAR columns were failing because of trailing spaces. However, on checking into it a bit closer, it seems that the columns in the result set are being described as varchar rather than char. The retrieved values do not contain trailing spaces when I access the database with DBD::Sybase built over the same revision of FreeTDS (but -- of course -- going over ct-lib).

any ideas as to why unixODBC and iODBC seem to be interpreting the column as a varchar rather than a char?

pjjH

[details]

The condition (line 2226 of dbdimp.c in DBD-ODBC-1.06) is:
	if (ChopBlanks && fbh->ColSqlType == SQL_CHAR && fbh->datalen > 0) {


on checking the DBI trace with freetds, I see:

   colname 14 = nodmst_name, len = 11 (194)
      col 14: VARCHAR  len= 30 disp= 31, prec= 30 scale=0



This is the (section of the) output I get from sp_help for the table.

        nodmst_name                                                             
                                                                                
                                                                                
                       
        char                                                                    
                                                                                
                                                                                
                       
        no                                           30            
        yes                                 no                                 
        yes                                
        SQL_Latin1_General_CP1_CI_AS                                            
                                                                                
                                                                                
                       


More information about the FreeTDS mailing list