Column and block text selection using SQL Server Management Studio

By:   |   Comments (7)   |   Related: > SQL Server Management Studio


Problem

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?

Solution

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. 

ssms shift select

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.

ssms shift alt select

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.

If you would like to select columns or blocks then Microsoft SQL Server offers a solution for you

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.

ssms ctrl shift end to select

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.

ssms ctrl shift home select

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.

ssms ctrl a to select all text

 

After making the selection, you can copy or delete the highlighted text.

Next Steps


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



About the author
MSSQLTips author Tibor Nagy Tibor Nagy is a SQL Server professional in the financial industry with experience in SQL 2000-2012, DB2 and MySQL.

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips



Comments For This Article




Sunday, October 20, 2019 - 8:48:13 PM - Jude Back To Top (82838)

another trick is to use ctrl + --> to quickly select a word instead of 1 letter


Wednesday, July 6, 2016 - 7:37:42 AM - Amar Back To Top (41823)

Thanks for the clarification Tibor. I have installed SSMS 2016. Now column operations are working + a host of features in Visual studio editor.


Tuesday, July 5, 2016 - 8:06:54 AM - Tibor Nagy Back To Top (41814)

Hi Amar,

 

Most of the column functions are available in SQL Server 2012 and up.

 

Regards,

Tibor


Monday, July 4, 2016 - 3:30:59 AM - Amar Back To Top (41809)

Sir, which version of SSMS are you talking about? I use the SSMS included with SQL Server 2008 and Column oprerations - SHIFT+ALT is not working :(


Friday, May 1, 2015 - 6:57:02 AM - Anderson Back To Top (37080)

 

Hi, Do you lknow why my Shift+Alt is not working anymore? It used to work just fine, now if I try to type something it will unselect whatever I had selected and only type in the first line.


Wednesday, December 3, 2014 - 4:08:45 PM - unblvr Back To Top (35491)

CTRL+Shift+v gives you the clipboard ring.


Monday, October 22, 2012 - 1:59:19 AM - Ravi Back To Top (20021)

In addition to the above SHIFT+ALT keyboard shortcut, CTRL+SHIFT+ALT keyboard shortcut will copy (copy and paste) the text instead of moving the text (cut and paste).















get free sql tips
agree to terms