pymssql callproc unicode返回一个

2024-09-30 08:33:36 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要通过callproc调用“sp_executesql”的帮助(我需要它作为RPC)。这是我的代码:

import pymssql
conn = pymssql.connect(host='11.22.33.44:1433', user='sa', password='XYZ', database='AdventureWorks')
cur = conn.cursor()
cur.callproc("sp_executesql", 'SELECT * FROM AdventureWorks.HumanResources.Employee WHERE BusinessEntityID = 109')

我得到这个错误:

^{pr2}$

运行其他存储过程非常顺利。 将字符串作为unicode运行(u'Select…')会出现以下错误:

Traceback (most recent call last):
  File "executesql.py", line 4, in <module>
    cur.callproc("sp_executesql", u'SELECT * FROM AdventureWorks.HumanResources.Employee WHERE BusinessEntityID = 109')
  File "pymssql.pyx", line 354, in pymssql.Cursor.callproc (pymssql.c:4177)
    raise NotSupportedError('Unable to determine database type')
pymssql.NotSupportedError: Unable to determine database type

你知道如何克服这个问题吗?在

SQL Server是 Microsoft SQL Server 2012-11.0.2100.60(X64)2012年2月10日19:39:15版权所有(c)Windows NT 6.1上的Microsoft Corporation Enterprise Edition(64位)(内部版本7601:Service Pack 1)(管理程序)

非常感谢


Tags: from错误employeeconnwhereselectdatabasesp
1条回答
网友
1楼 · 发布于 2024-09-30 08:33:36

我也遇到了同样的问题。似乎已经在Issue 56中报道过。 到目前为止还没有解决。:(

更新:我找到了解决“无”问题的方法。查看我的线程here。在

相关问题 更多 >

    热门问题