This is my first question. Therefore, sorry if it repeats or formatting is disabled. I looked at other questions, and the error is common, but appears in several situations.
I have very simple python code where I want to execute a procedure in MSSQL from pyodbc.
import pyodbc conn = pyodbc.connect(r'DSN=myDSN') cursor = conn.cursor() query = r'{call myproc}' cursor.execute(query)
I use a call instead of exec after reading when ODBC uses a call to execute procedures in MSSQL.
The error I am getting is the following:
Traceback (most recent call last): File "myscript.py", line 26, in <module> cursor.execute(query) pyodbc.ProgrammingError: ('42000', '[42000] [Microsoft][SQL Server Native Client 11.0][SQL Server]The current transaction has aborted, and any pending changes have been rolled back. Cause: A transaction in a rollback-only state was not explicitly rolled back before a DDL, DML or SELECT statement. (111233) (SQLExecDirectW)')
thanks for the help
source share