如何使用 pyodbc 获取 SQL Server 存储过程返回值? [英] How to get a SQL Server stored procedure return value using pyodbc?

查看:96
本文介绍了如何使用 pyodbc 获取 SQL Server 存储过程返回值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的团队使用基于 Python 的 wiki 服务器,该服务器调用 SQL Server 数据库上的存储过程.理想情况下,我们希望从存储过程返回整数值 (1,0,-1) 以显示基本结果.

My team's using a python-based wiki server that calls stored procedures on a SQL Server database. Ideally, we'd like to return integer values (1,0,-1) from the stored procedure to show basic results.

根据 2008 年 Google 网上论坛上的帖子,返回值是'pyodbc 不支持,因此另一种方法是将结果 SELECT 作为一行并进行检查.还是这样吗?是否有(支持和记录的)编程方式来检查 SQL 存储过程的返回值?(如果是这样,请添加当前参考或示例.)

According to a 2008 thread on Google Groups, return values aren't supported by pyodbc, so the alternative is to SELECT the result as a row and check it instead. Is that still the case? Is there a (supported and documented) programmatic way to check the return value from SQL stored procedures? (If so, please add a current reference or example.)

推荐答案

以下是一些相关信息:http://code.google.com/p/pyodbc/wiki/StoredProcedures

听起来仍然不支持返回值,因此您需要使用 SELECT.

It sounds like return values are still not supported, so you'll need to use a SELECT.

这篇关于如何使用 pyodbc 获取 SQL Server 存储过程返回值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆