The code you posted:
IF @@TRANCOUNT > 0
ROLLBACK TRANSACTION;
says to rollback if there is any transaction active.
That's probably not what you want!
I suspect what you actually want is this:
IF @@TRANCOUNT > 0
COMMIT TRANSACTION;
Question
I have a IIS hosted Python application and the front application always failed to save.
I noticed that there are a lots of transaction count more than 0 then rollback when SQL Profiler running and those application name is IIS.
Sometime it did commit when transaction count more than 0 as well.
I wondering what does that mean and where can I locate the script that execute this control.
Will it be caused by query design problem? Much appreciate for any advice.
IF @@TRANCOUNT > 0
ROLLBACK TRANSACTION;
La solution
The code you posted:
IF @@TRANCOUNT > 0
ROLLBACK TRANSACTION;
says to rollback if there is any transaction active.
That's probably not what you want!
I suspect what you actually want is this:
IF @@TRANCOUNT > 0
COMMIT TRANSACTION;