Shortcut: Selecting and modifying rectangular regions in SSMS
I often see people using SQL Server Management Studio (SSMS) and doing very repetitive editing tasks that could easily be carried out by using the selection and changing of rectangular regions of code.
The simplest example of doing this is to insert a bit of text on a number of rows. Take the following code as an example:
I’ve got the skeleton of a list of columns in a CREATE TABLE statement but let’s assume that I’m a “comma in front” person and want to put a few spaces and a comma, etc. in front of each column after the second. I could just put the cursor on the InvoiceID line and type what I wanted, then do the same again on the next line. I could do it on the first line, then select and copy it, and insert it into the front of every other line. But what I should do is put the cursor in front of InvoiceID, and while holding Alt-shift, use the down arrow to select the beginning of every line, then just type what I want.
2017-11-23