I have an Amazon EC2 instance hosting a Microsoft SQL Server, and I'm attempting to execute a stored procedure programmatically using Python and ODBC. While I can successfully execute the stored procedure through SQL Server Management Studio, I encounter an issue when attempting to execute it using Python and ODBC.
connection = pyodbc.connect(conn_str)
print("Connected to DB")
cursor = connection.cursor()
cursor.execute(f"EXEC <schema>.<procedure-name>")
cursor.fetchall()
I tried this, but it is returning None.
Additional Things:
- I have confirmed that the connection string (conn_str) is correct.
- The stored procedure executes successfully in SQL Server Management Studio.
- I have checked the permissions for the stored procedure and verified that the user has the necessary permissions to execute it.
- I'm using Python and pyodbc