Column and block text selection using SQL Server Management Studio

By:   |   Updated: 2012-10-19   |   Comments (6)   |   Related: More > 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


Last Updated: 2012-10-19


get scripts

next tip button



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.

View all my tips
Related Resources




Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name
*Email
Email me updates

Signup for our newsletter

I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.





Wednesday, July 06, 2016 - 7:37:42 AM - Amar Back To Top

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 05, 2016 - 8:06:54 AM - Tibor Nagy Back To Top

Hi Amar,

 

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

 

Regards,

Tibor


Monday, July 04, 2016 - 3:30:59 AM - Amar Back To Top

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 01, 2015 - 6:57:02 AM - Anderson Back To Top

 

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 03, 2014 - 4:08:45 PM - unblvr Back To Top

CTRL+Shift+v gives you the clipboard ring.


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

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).



download

























get free sql tips

I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.



Learn more about SQL Server tools