不能用 DB-Library(如 ISQL)或 ODBC 3.7 或更早版本将 ntext 数据或仅使用 Unicode排序规则的 Unicode 数据发送到客户端。查了一下,发现官方网站有解释: [quote] [i][b]Q: What means "Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library"?[/b][/i] [b][i]A: [/i][/b]If you connect to a SQL Server 2000 SP4 or SQL Server 2005, and if you make a SELECT query on a table that contains a column of type NTEXT, you may encounter the following error: _mssql.error: SQL Server message 4004, severity 16, state 1, line 1: 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. It's the SQL Server complaining that it doesn't support pure Unicode via TDS or older versions of ODBC. There's no fix for this error. Microsoft has deprecated DB-Library a long ago, in favor of ODBC, OLE DB, or SQL Native Client. Many new features of SQL 2005 aren't accessible via DB-Library so if you need them, you have to switch away from pymssql or other tools based on TDS and DB-Library. A workaround is to change the column type to NVARCHAR (it doesn't exhibit this behaviour), or TEXT. [/quote] 大概意思是,这是因为我们的pymssql使用早期的ODBC函数集来获取数据。后来微软才引入了ntext和nvarchar类型,但Microsoft并没有更新他们的 C-library,所以就没办法支持了。建议:将ntext修改为nvarchar或text. 显然,这不是个好的解决方法,那么是否就没有其他办法了呢? 还好,不用绝望,既然不支持ntext但支持text,那么我们只需要在输出时将ntext转换为text就好了,方法很简单:
SELECT cast ( field_name AS TEXT ) AS field_name
SET TEXTSIZE 65536
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有