Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# and SQL Server: any reason to put a single INSERT into a transaction?

Using C# and SQL Server, would there be any reason to put a single INSERT statement into a transaction?

I am reviewing code written by someone else. I can't understand why a transaction would be needed since there is only one SQL statement.

like image 626
CJ7 Avatar asked Dec 16 '22 22:12

CJ7


1 Answers

It will already be in an implicit transaction. No need to wrap it in another redundant transaction.

like image 184
Oded Avatar answered Jan 22 '23 12:01

Oded