Column and block text selection using SQL Server Management Studio
By: Tibor Nagy | Updated: 2012-10-19 | Comments (7) | Related: More > SQL Server Management Studio
I am using an advanced text editor which is capable of selecting and editing columns. This is a very useful feature, for example I can highlight and edit the last 5 columns of each row. Does Microsoft SQL Server Management Studio have a similar feature?
There are several ways to select text as shown below, including the ability to select and edit columns.
Using SHIFT to Select Text
It is well known that using the SHIFT key you can perform normal text selection in SSMS.
If you put your cursor to the left of "dbo.DimEmployee" and hold the SHIFT key and then put your cursor at the end of "dbo.DimReseller" it will select the first three lines of code as shown below.
Using SHIFT+ALT to Select Columns
If you would like to select columns or blocks then Microsoft SQL Server offers a solution for you. You can use the key shortcut SHIFT+ALT as described in the following steps. Please note that this feature works using SSMS for SQL Server 2008 and up.
Place your cursor to the left of "dbo.DimEmployee", press SHIFT+ALT then click at the end of "dbo" in "dbo.DimProductCategory". This will select columns or blocks in SQL Server Management Studio as shown below.
Using SHIFT+ALT to Select Columns and Insert Text
In SSMS for SQL Server 2012 and up, you can also use SHIFT+ALT to insert text in this block mode.
First place the cursor in the first row where you would like to insert the text (to the left dbo.DimEmployee in our example). Press SHIFT+ALT and click in the last line where you would like to append this text (left of dbo.DimProductCategory). Now type "SELECT * FROM " and this text will be inserted for each line as shown below.
Using CTRL+SHIFT+END to Select Text
If you want to select all text from a starting point to the end you can use CTRL+SHIFT+END.
Put your cursor at the beginning point and press CTRL+SHIFT+END to select all text from that point to the end of the text as shown below.
Using CTRL+SHIFT+HOME to Select Text
If you want to select all text from a starting point to the beginning you can use CTRL+SHIFT+HOME.
Put your cursor at the beginning point and press CTRL+SHIFT+HOME to select all text from that point to the beginning of the text as shown below.
Using CTRL+A to Select All Text
If you want to select all text you can use CTRL+A.
Just press CTRL+A anywhere in the query editor and this will select all text as shown below.
After making the selection, you can copy or delete the highlighted text.
- Check out these related tips to learn more about SQL Server Management Studio shortcuts:
- Check the SQL Server Management Studio Tips category for more articles
- Read more tips by the author here.
Last Updated: 2012-10-19
About the author
View all my tips