Can't access ntext db columns on Sql Server

I’m not able to access to the content of columns of type “ntext” on Sql Server Express 2005 database.

2009/08/27 12:57:36 [error] [system.db.CDbCommand] Error in querying SQL: SELECT TEXT BASICREG WHERE ID = ‘1389’

2009/08/27 12:57:36 [error] [exception.CDbException] exception ‘CDbException’ with message ‘CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 10007 No se pueden enviar datos de Unicode de intercalaci�n exclusiva de Unicode o datos ntext mediante DB-Library (como ISQL) o la versi�n ODBC 3.7 o anterior. [10007] (severity 5) [SELECT TEXT FROM MAININFO WHERE ID = ‘1389’]’ in C:\Inetpub\wwwroot\Genberg\framework\db\CDbCommand.php:295

It seems like PDO driver doesn’t support the “ntext” SqlServer types ?

I’m using Yii framework 1.0.5 and PHP v.5.2.1 with PDO mssql extension.

It would be helpful if you translated the general error message to English.

Hi pestaa,

Here’s the message:

SQLSTATE[HY000]: General error: 10007 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. [10007] (severity 5)

Thanks in advance,

Please look at this article, I hope it’ll help you.

Thanks for the suggestion. I follow the steps from microsoft article, but yii ( or PDO ) raise the same error.

I’ve found a partiall solution:

Instead of querying: “SELECT TEXT FROM MAININFO WHERE ID = ‘1389’”

i convert “TEXT” field explicity to varchar(N): “SELECT CONVERT(VARCHAR(8000),TEXT) as TEXT FROM MAININFO WHERE ID = ‘1389’”

but then I must to rewrite all de CRUD operations, etc. ( and can’t use yii::AR functionallity! )

Converting text fields in each request is not that quick either.

Since this problem is not Yii-related (nor even MySQL-related), I don’t think I can help you out.

You probably have selected ntext with reason, but this case might be another reason to reconsider field type.