Execute SQL Server Stored Procedure - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Execute SQL Server Stored Procedure (/thread-24524.html) |
Execute SQL Server Stored Procedure - brijeshkumar_77 - Feb-18-2020 I need to execute a Stored procedure in SQL Server and capture all Print statements inside the SP. In addition to this, for other SP's i want to access the result set of the Stored Procedure. I have tried using few libraries like pyodbc, jaydebeapi etc. but none worked db_conn = pyodbc.connect(connection_string) sql = """\ DECLARE @RC int; SET ANSI_WARNINGS OFF; SET NOCOUNT ON; {Call [dev_1].[sp_testing] (?, ?, ?)}; SELECT @RC AS rc; """ values = (parm1, parm2, parm3) cursor = db_conn.cursor() cursor.execute(query_string, value) rows = cursor.fetchall() Can anyone suggest how can achieve this. Is there any other library that i can use to achieve this. Appreciate your help with this. Thanks It is now working. I missed to put the commit db_conn.commit() it solved the issue. |