Re: FreeTDS and nvarchar(MAX) in MSSQL-2005+

Chad Johnson <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
> "[FreeTDS][SQL Server]Unicode data in
> a Unicode-only collation or ntext data cannot be sent to clients using
> DB-Library (such as ISQL) or ODBC version 3.7 or earlier. SQLState=42000
> ErrorCode=4004]"
>
> Any clues on this? I am attaching the FreeTDS configuration file along
> with this email.  On the similar note does FreeTDS 0.82 support
> reading of nchar, nvarchar, ntext fields
> from MSSQL 2005/08 server?

When using a Perl / DBD::ODBC stack I was able to extract nvarchar /
ntext / nvarchar(max) (in full unicode glory) with 0.82.  Insert /
update's would not work.  The prerelease of 0.83 fixed that problem
(i.e. 0.83 now allows you to bind character data as SQL_WVARCHAR).

FreeTDS itself does support these datatypes.  It's up to your software
stack to ensure that these features work correctly though.

Be on the lookout for :

1.) Using, at least, tds version 7.0 or above
  - freetds.conf property `tds version`
2.) Setting the charset to UTF-8
  - freetds.conf property `client charset`
3.) Setting the upper limit on text / image / nvarchar(max)
  - freetds.conf property `text size`

Also, if you are using PHP this seems to be a known issue if your
peruse the MSSQL comments at :

http://us3.php.net/function.mssql-query

You'll see other people running into this issue.

-Chad J
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.