php查询SqlServer报错问题ntext data cannot be sent to clients using DB-Library

来源:互联网 发布:php竞价推广系统源码 编辑:程序博客网 时间:2024/05/24 06:41

提示错误

Warning:mssql_query() [function.mssql-query]: message: Unicode data in a Unicode-onlycollation or ntext data cannot be sent to clients using DB-Library (such asISQL) or ODBC version 3.7 or earlier.

 

 

在网上找到3种解决方法

1:将所查询的字段 ntext类型的转化成text类型

2:改变查询语句 类似:SELECT CAST(field1 AS TEXT) AS field1 FROM table

3Open up your free tds configuration file (/etc/freetds.conf), and change:[global] tds version = 4.2 change to version = 8.0

 

 

 

试了第3种方法,结果把汉字都转成?了,不管用,最后用方法2,找到几个nvarchar的字段sql语句转换AS TEXT才解决问题。