If It runs by accident after I write the command, it'll rollback then the commit will throw an error which is fine.
When I'm ready to run, I'll highlight (in SQL Studio, you can highlight the part you'd like to run) the BEIGN TRANSACTION and the command. If I like the results I'll highlight and run the commit otherwise the highlight and run the commit.
View all comments
Show parent comment
3
u/realzequel Oct 14 '25
So I start ad-hoc commands with:
BEGIN TRANSACTION
[SPACE FOR COMMAND....]
ROLLBACK TRANSACTION
COMMIT TRANSACTION
If It runs by accident after I write the command, it'll rollback then the commit will throw an error which is fine.
When I'm ready to run, I'll highlight (in SQL Studio, you can highlight the part you'd like to run) the BEIGN TRANSACTION and the command. If I like the results I'll highlight and run the commit otherwise the highlight and run the commit.