下面是调用方式:
Example script - pymssql module (DB API 2.0)
Example script - _mssql module (lower level DB access)
不过,在我使用过程中,发现,如果表中包含了ntext字段,就会出错,提示
不能用 DB-Library(如 ISQL)或 ODBC 3.7 或更早版本将 ntext 数据或仅使用
Unicode排序规则的 Unicode 数据发送到客户端。
查了一下,发现官方网站有解释:
Q: What means "Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library"?
A: 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.
大概意思是,这是因为我们的pymssql使用早期的ODBC函数集来获取数据。后来微软才引入了ntext和nvarchar类型,但Microsoft并没有更新他们的 C-library,所以就没办法支持了。建议:将ntext修改为nvarchar或text.
显然,这不是个好的解决方法,那么是否就没有其他办法了呢?
还好,不用绝望,既然不支持ntext但支持text,那么我们只需要在输出时将ntext转换为text就好了,方法很简单:
SELECT cast ( field_name AS TEXT ) AS field_name
唯一的问题,可能是ntext和text字段所支持的长度不一样,所以也许你还需要设置一下TEXTSIZE
SET TEXTSIZE 65536
当然,你还可以将字段设置的大一点,这个就看你的需要了。
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。
更新日志
- 炉石传说移动端商店打不开怎么办 移动端商店打不开解决方法分享
- 王菲《我的世界2》日本唱片志限量编号10CD[WAV+CUE]
- 乌兰托娅《爱从草原来HQII》头版限量编号[低速原抓WAV+CUE]
- 魏妙如.2017-《伟大的旅行》[WAV分轨]
- 科乐美送短跑冠军牌佬豪华礼包:顶罕卡片、决斗盘等
- 重大进展!PS4模拟器运行《重力眩晕:重制版》演示
- 南半球爱好者的福利 日本御姐级樱花妹高挑性感
- 玩家热议:哪些游戏通关后才算正式开始?
- 知名博主称赞《影之刃零》:有望成为现代最强之一?
- 泳衣快兜不住了!《莱莎工房》莱莎琳新手版开放预订
- 5.1版本「绘想游迹」全新游迹特效展示
- 原神纳塔篇OST&四周年分享H5正式上线
- 《原神》「星路拾忆」网页活动壁纸展示
- 群星.2024-祝你幸福!电影原声带【阿里巴巴】【FLAC分轨】
- 于台烟.2004-执着【乾坤唱片】【WAV+CUE】