SSMS – Shortcuts and Snippets to Select Code Block

ssms

I am using SQL Server Management Studio 2016 on Windows 10. I'm tired of using shift/ctrl+up/down/right/left keys to select the code I want to run. I'm wondering whether there are shortcuts/snippets to select a block of code that separated from other code by blank lines?

Here is a code example:

select *
from tab1

select *
from tab2

select *
from tab3

Say, my cursor is inside the middle block and what's the best way to select the middle block?

Best Answer

I'm not affiliated to Red-Gate, but I would like to point out that if you hit Shift-F5, when you own a newish copy of SQL Prompt, then the query your cursor is on, will be marked green, and executed.

It has really saved me a lot of keystrokes.