[freetds] Problems with nvarchar

ZIGLIO Frediano Frediano.Ziglio at mail.vodafone.it
Mon May 12 11:56:27 EDT 2003


> 
> I have this system:
> MS SQL 2000 sp2, freetds-0.62.dev.20030508, unixODBC-2.2.5
> 
> I have made a small test database on the SQL-server:
>  DB name: JCTest
>  One table with name: text
>  One column with name: textcol
>  Datatype and length: nvarchar 20
> 
> One entry in the table:
>  textcol = 'Excellent test' 
> 
> If I run the isql-program that comes with unixODBC, I connect 
> OK and try
> this statement:
> select * from text;
> That should return 'Excellent test' but return this:
> +---------------------+
> | text                |
> +---------------------+
> |                     |
> +---------------------+
> 1 rows affected
> 1 rows returned
> 
> If I enter the same statement again I get this:
> [unixODBC]Changed database context to 'JCTest'.
> [unixODBC]Changed language setting to us_english.
> [unixODBC]Option not supported
> [ISQL]ERROR: Could not SQLExecute
> 
> If I change data type to 'char' or length to i.e. 50 then suddenly
> everything works as it should.
> 
> How is this possible? What do I do wrong?
> 
> I'm fairly new to this, so I'm not sure if it's the fault of 
> me, FreeTDS
> or unixODBC. Any pointers to fixing this problem will be greatly
> appreciated.
> 

I tried with RH8 (UTF-8) with

select convert(nvarchar(20),convert(varchar(20),'Excellent test')) as text

as return correct results

same for 

select convert(nvarchar(300),0x20002100220023002400250026002700280029002A002B002C002D002E002F0030003100320033003400350036003700380039003A003B003C003D003E003F0040004100420043004400450046004700480049004A004B004C004D004E004F0050005100520053005400550056005700580059005A005B005C005D005E005F0060006100620063006400650066006700680069006A006B006C006D006E006F0070007100720073007400750076007700780079007A007B007C007D007E007F0080008100820083008400850086008700880089008A008B008C008D008E008F0090009100920093009400950096009700980099009A009B009C009D009E009F00A000A100A200A300A400A500A600A700A800A900AA00AB00AC00AD00AE00AF00B000B100B200B300B400B500B600B700B800B900BA00BB00BC00BD00BE00BF00C000C100C200C300C400C500C600C700C800C900CA00CB00CC00CD00CE00CF00D000D100D200D300D400D500D600D700D800D900DA00DB00DC00DD00DE00DF00E000E100E200E300E400E500E600E700E800E900EA00EB00EC00ED00EE00EF00F000F100F200F300F400F500F600F700F800F900FA00FB00FC00FD00FE00FF00)

(using current CVS, of course...)
Are you using TDS8 or TDS7 ??

Try setting TDSDUMP to a file and send file (check file and remove possible secret information, login packet, with password,  is automatically removed from log)

freddy77



More information about the FreeTDS mailing list