Execute current statment
Shift-F5 is great but I think this change could make it better.
Before I discovered Shift-F5 and when I had multiple sql statements in my window, I would select the block of sql I wanted and hit F5 to just execute that code block. Then I discovered Shift-F5 and I no longer had to select my sql block it was done for me - but what it doesn't do is actually select the code block, instead it just highlights it in green and executes it. So if you just do an F5 (out of habit) after a Shift-F5 it won't execute the green code block it will run everything in the code window (which sometimes is dangerous and not usually what you meant to do). My suggestion is instead of highlighting in green can you just actually select the block of code - that way if we (out of habit) hit F5 the second time the same code block is executed again? Thanks.
-
Darek commented
I'd like to add to it. In Visual Studio there is a way to actually select a block code based on its semantics. What's more, one can repeatedly press the same key (can't remember which one at the moment) and the selection will expand appropriately highlighting only the semantically valid piece of code. This, in fact, is an awesome feature as it enables you to not only select a valid chunk of code but also makes it easy to see where the pieces start and end. For SQL that would be a killer feature based on the fact that query tuning very often consists of copying part of code and making multiple copies of it with slight variations to compare one to the other.
-
Tony Waddle commented
Possibly an extension to this; a shortcut that just highlights the current query/code block (without executing) would be very useful when writing SQL - you can then copy/cut and change the order, remove it completely, use a snippet to insert around the highlighted text (cte, try catch), etc