SQL Server Transaction Name

When you create an explicit transaction within SQL Server, please remember that it is case sensitive even if your instance is not case sensitive

I had an issue today running a colleague’s code (the rollback and commit were commented out, but that is another story). The code failed and I tried to rollback the transaction but received this error message;

Msg 6401, Level 16, State 1, Line 5
Cannot roll back t1. No transaction or savepoint of that name was found.

Looking closer, I spotted a lower case transaction name and updated this to T1 which then allowed the rollback to complete. Ordinarily, when I use explicit names, I use copy and paste for the commit and rollback so I hadn’t seen this issue for a long time.

One response on “SQL Server Transaction Name

Leave a Reply