Closed p-doyle closed 3 years ago
There are a few TRY/CATCH blocks in the stored procedure, but nothing that's expected to doom your transaction like that. Are you getting a line number?
I'm executing this from python and this is the full error:
('42000', '[42000] [FreeTDS][SQL Server]The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction. (3930) (SQLExecDirectW)')
Not sure if 3930 is the line number?
3930 is the error number. Seems that FreeTDS is not returning all of the information. Are you able to run an Extended Events session and capture some more information? Here's a decent looking guide that just came up when I googled: https://www.sqlservercentral.com/blogs/capture-sql-server-reported-errors-using-extended-events
Just to make sure, you don't have an external transaction of some sort, do you?
And on that last point -- do you have autocommit enabled on your connection from Python? (If you don't, you should, at least for this case. I like it for pretty much everything, though.)
Ah that event session thing looks cool... unfortunately it does not seem to be available on RDS as far as I can tell :(
Not exactly sure what you mean by external transaction but I don't think so.
It wasn't. I enabled it and haven't gotten any errors in the last hour so hopefully that fixed it.
Thanks for the help!
I'm executing the store procedure periodically and writing it to a table in tempdb using:
I've recently started getting this error about once an hour:
The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction.
A google search seems to indicate I should add a try/catch around the sp and then rollback if there is an error... is that something I should be expected to do when executing this? Or is there something else that might be going on?
For reference I am on SQL Server 2017 Standard Edition14.0.3281.6 (X64) on AWS RDS.