Shane O’Neill shares a few methods for preventing accidental script runs:
Recently I came across a question in Stack Overflow (SO) that said the following:
The other day I was trying to hit another button on the menu but hit Execute – which executed the whole code and ended up deleting some tables. I have always found this scary that hitting one button can execute the whole code.
I want SQL Server to execute code only when something is selected. Is it possible? Or can SQL Server prompt before executing a query?
I thought this is a great question because it can be answered in 4 different ways…
Click through for those four methods.