In SSMS (the main query console tool thing for Sql Server) you can highlight a bit of code with the cursor (as if you want to copy/paste it) and press CTRL-E to execute it, its really handy when you've got a big sketchpad-like series of SELECT statements and you're doing exploratory tinkering.
But if your UPDATE statement is accross three lines, its a little bit too easy to accidentally select just the first two lines and not select the third line that has the WHERE clause. Then CTRL-E and you've footgunned yourself.
Its never actually happened to me, but I've often thought it probably has happened to some people.
I once saw a coworker get destroyed by a rendering glitch in SSMS - he had GPU acceleration enabled and didn't notice his text selection highlight glitching out, smashed F5 on a query that looked like it had a where clause selected but if you fiddled with the scrollbar suddenly it wasn't actually selected. I noticed his query blocking everything and killed it, walked over to his office like WTF and he reran it right in front of me reproducing the glitch exactly - he couldn't believe what he'd done. disabling GPU acceleration in SSMS fixed it.
The GPU accelerated text rendering in SSMS 18 is incredibly bad. The other thing it likes to do sometimes is continue showing the text from tab A when you switch to tab B, until you scroll (not possible in short snippets) or edit it (and only the edited part updates!)
I'm still so confused about why a glorified text editor would need GPU accelerated text rendering. It's never rendered slow for me before. Seems like not trusting the OS to do things right and re-inventing the wheel yourself for little gain.
I’ve had something similar happen with lag on the right-click menus. It’s very easy to actually be clicking on the wrong option, like “Delete database,” because there was lag in updating the cursor position. Happens in scary places like MMC too. Hope you don’t accidentally drop a cluster volume because windows wasn’t done drawing a pretty arrow!
I worked at a place where this happened pretty much monthly, in production. Outages, blown SLA $$$, uptime metrics blown. Certain teams’ entire toolbox was a sql script with various query templates commented out, that they tweaked, manually highlighted, and ran. Passwords, configs, user data, all got wiped out this way. No one got fired, no one got reprimanded, the workflow didn’t change despite this happening over and over. And each time the DBA team got to spend a few hours restoring a multi-TB backup so that someone could grab the prior data from the table they wiped out. Middle of the night? No problem, wake up the DBAs and go back to bed, it’s not like there would be any consequences.
I have, although nothing deadly serious. I guess that SQL statements in a text file are not really the correct management tool for a production database. If we are needing to do these sorts of things, we should have an admin app or tool that can ensure we do things correctly.
In SSMS (the main query console tool thing for Sql Server) you can highlight a bit of code with the cursor (as if you want to copy/paste it) and press CTRL-E to execute it, its really handy when you've got a big sketchpad-like series of SELECT statements and you're doing exploratory tinkering.
But if your UPDATE statement is accross three lines, its a little bit too easy to accidentally select just the first two lines and not select the third line that has the WHERE clause. Then CTRL-E and you've footgunned yourself.
Its never actually happened to me, but I've often thought it probably has happened to some people.