Josh Darnell points out that transactions don’t really begin with BEGIN TRAN
:
Of course, no one reads the documentation. And even if they do, they certainly don’t continue on to the 4th paragraph of the “General Remarks” section. That’s like going to the second page of Google search results.
If one did trudge on through the docs, they would find this gem:
Although BEGIN TRANSACTION starts a local transaction, it is not recorded in the transaction log until the application subsequently performs an action that must be recorded in the log, such as executing an INSERT, UPDATE, or DELETE statement. An application can perform actions such as acquiring locks to protect the transaction isolation level of SELECT statements, but nothing is recorded in the log until the application performs a modification action.
Well that’s interesting! Let’s check it out.
Four paragraphs? Where’s the tl;dr, Microsoft Docs?
Read the whole thing even though Josh just made a joke about nobody reading the whole thing and I followed along with it.