首页 > 精选文章 > 数据库开发 > 正文

不能用DB-Library(如 ISQL)或 ODBC 3.7或更早版

Warning: mssql_query() [function.mssql-query]: message: 不能用 DB-Library(如 ISQL)或 ODBC 3.7 或更早版本将 ntext 数据或仅使用 Unicode 排序规则的 Unicode 数据发送到客户端。 (severity 16) in D:PHPnowhtdocssincludedb_mssql.class.php on line 55

Warning: mssql_query() [function.mssql-query]: Query failed in D:PHPnowhtdocssincludedb_mssql.class.php on line 55
MsSQL Query:SELECT * FROM PE_Config 
MsSQL Error:1 
MsSQL Errno:1 
Message:MsSQL Query Error



在PB开发过程中,由于数据库中使用了 ntext字段,出现以下提示错误,郁闷了很长时间找不到解决方案,后查阅大量资料,终于明白:

PB报错: 不能用 DB-Library(如 ISQL)或 ODBC 3.7 或更早版本将 ntext 数据或仅使用 Unicode 排序规则的 Unicode 数据发送到客户端。

————————————————

由于sql server中,ntext和nvarchar字段是用unicode编码存储内容的,因此php通过mssql扩展读取带ntext和nvarchar类型字段的时候会抱错。

如果 title 字段类型为 nvarchar,content 字段类型为 ntext ,那么下面的sql语句会报错:

select title,content from article where 1

正确的写法是:

select convert(varchar(255),title) as title, convert(text,content) as content from article where 1

或者不使用ntext字段

  • 上一篇:linux下/dev/shm是什么?
  • 下一篇:蔡文胜:未来3年是黄金期 手机是最重要应用
  • 了解这些字:不的意思 能的意思 用的意思 如的意思 或的意思 或的意思 更的意思 早的意思