THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Andrew Kelly

Seldom Used Keyboard Tricks


I was giving an internal talk on SSMS productivity trips and there were a few that I believe are seldom used but can be a real time or keystroke saver that I would like to mention. To the best of my knowledge these will work in any version of SSMS from at least 14.0 onward and likely earlier but I can’t verify older versions at this time. Since these are basically Visual Studio shortcuts they also work in Visual Studio and SSDT to the best of my knowledge. The first is the ability to select text in a vertical fashion as shown in the examples below. Before we get to how to do that I know your first question is why would you want to do that. Well I will leave all the possibilities up to you since everyone has slightly different techniques and circumstances. However I am confident that after seeing a few examples it will spark interest in many of you and you will immediately think of times when this will help you code more efficiently.

OK now on to the HOW to do this. That part is really pretty simple and there are two ways that I know of off hand. BTW, I am sure that after playing with this for just a few minutes you will have figured it all out anyway but I will post some instructions and examples just the same. The first way is to position your mouse cursor on the line at the point in which you want to start. Then you can use your keyboard and press SHIFT – ALT and then use the arrow keys as you see fit. Or you can press only the ALT key and move your mouse in the direction you wish to highlight or operate on. Both techniques mentioned will give you the same results. I find the mouse method a little easier overall but YMMV. I will use the block of code shown directly below as the basis for most of the subsequent examples.


Keep in mind that there are 2 types of processes or operations that you might use this for. The first is typically used when you want to insert something into existing code at a certain spot but across multiple lines at once. The example directly below shows what that would look like when selecting the rows at a specific position or insertion point. If I placed my cursor just in front of the number 1 in the first row and then pressed SHIFT – ALT – Down Arrow 7 times I would get a thin (in this case blue) line like the one with the arrow pointing to it. More on this technique shortly.



However if I needed to use the second type of operation I would take that one step further and move my cursor / mouse left or right to highlight one or more characters in each row as shown below.


Once I have highlighted a set of rows / columns I can then replace that highlighted text with new text of my choosing in a number of ways. If I had something in my clipboard I can do a paste and all of the highlighted sections in each row will be replaced with the clip board contents.  OK I hear someone saying well you could have just done a search and replace. Well sure but if you look closely you will see each character that I had highlighted in the vertical column was a different value in each row. I would have had to do 8 different search and replaces instead of just one using this method. Or I can simply start typing and you will see the original text is instantly replaced with what ever I type as shown in the partially completed replacement below.


Another great benefit of this technique is that you can be selective in which blocks of code you want the text replaced or acted upon. For instance I want to operate on only 4 of the 8 lines of code. If I did a search and replace I would have to do this one line at a time and choose which line I wanted to act upon and which I wanted left alone.


Here I selected the middle 4 lines and upper cased the word select. How did I do that? Well this technique also works with standard keyboard short cut’s such as Ctrl- Shift-U which will upper case what ever is highlighted as I did below.  I am sure you can begin to see the possibilities of this technique.



In this example shown below I use the other technique mentioned earlier to position the cursor at a certain place vertically across what ever rows I need.


I often have to terminate a number of rogue processes at the spur of the moment and this technique comes in very handy for that. I can identify the session_id’s using something like sp_whoisactive but when there are multiple sessions it can get tedious and error prone to manually type the “KILL nnn” commands for each one. Now I can simply copy the list of session_id’s and paste them into a query window and set the insertion point directly in front of all the session_id’s at once. Now I simply type “KILL “ and it instantly fills this in at the correct spot before all the lines at once. Again this is impossible to do with search and replace as each row is different text. Now all I had to do is execute the batch and smile as I rest assured the SQL Server instance is once more safe from these rogue processesSmile.  Obviously you will find more uses for this based on your own environment but I think you get the idea.


And finally I wanted to point out that if you are using the pure keyboard method don’t forget to use the SHIFT along with the ALT. If you simply press just the ALT key plus an up or down arrow you will shift the line the cursor is on up or down one line for each arrow press. The example below shows what happens if the cursor was anywhere on line 3 and the ALT and up arrow key was pressed. While that tip can certainly come in handy as well it may not do what you expect. If you use the ALT and Mouse method this will not happen.



I realize this was a long winded set of examples but I had fun outlining them. This is a very under utilized set of features that is built into some of your most important daily tools so remember to take advantage of them. I have also include a few links to some more extensive lists of short cuts for SSMS that you should find useful.

BOL SSMS Keyboard Shortcuts

Andy Mallon’s SSMS Keyboard Shortcuts

Red-Gate SSMS Keyboard Shortcuts




Published Thursday, June 22, 2017 10:48 AM by Andrew Kelly

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS



zhang said:    chrome store    Nike Jordans    michael kors australia    yeezy boost 350 shoes    coach factory outlet    louis vuitton us    michael kors australia    snow boots uk    pandora ring    michael kors    kate spade handbags    Air Max 90 Femme    pandora uk    business blog    ray ban sunglasses    official coach outlet site    kate spade canada    myhermes parcel shop    pandora charms    Nike Schuhe Damen    Wave Prophecy 2 Shoes    puma shoes    louboutin shoes    sunglasses hut    Nike Air Max 2017    gel kayano    fun games for kids    chanel outlet    birkenstock outlet    cheap ray ban    michael kors outlet    Obat Kuat Sex    puma oulet sale    kate spade    coach factory outlet online    clb shoes sale    north face outlet    Jared Jewelry - Official    Nike Free    kate spade outlet    ray ban frames    michael kors    kate spade outlet    coach factory outlet    kate spade outlet    China wholesale    ray ban sunglasses    oakley outlet    coach outlet online    kate spade new york store    ray ban uk    chanel outlet    jimmy choo outlet    birkenstock canada    payless shoes    pandora australia    black friday deals online    ray ban sunglasses    Prada Shoes - Official    fulam shoes    articles    pandora rings uk    burberry outlet    pandora uk    ugg boots    tory burch outlet    jimmy choo heels    louis vuitton outlet    nbastore    timberland boots    school bags online    nike huarache shoes    Louis Vuitton Outlet    omega watches    clearance    Prada Sunglasses - Official    michael kors outlet    nike outlet    Kay Jewelers - Official    ray ban justin    Air Jordan Homme    Dreamland Jewelry - Official    burberry outlet sale    pandora necklace    Nike Air Max 90 Mes    Nike Blazer Femmes    nike outlet    puma shoes    Online Oyun    timberland boots    michael kors uk    michael kors uk    Nike Boots    Engagement Rings - Official    Wholesale womens autumn winter clothing    under armour outlet    mulberry outlet    coach handbags sale    black friday deals    yeezy boost 350    louis vuitton    Kaufen Nike Air Max 1    Air Max 1 Homme    michael kors australia    pandora jewelry sale    michael kors australia official    Louis Vuitton Online    michael kors australia    ray-ban glasses    soccer store    pandora outlet    hermes outlet    The Retail Compliance Association    Nike Free Run    Nike Schuhe Herren    tory burch outlet    Louis Vuitton Outlet    ray ban wayfarer sunglasses    michael kors    official louis vuitton    ray ban shop    Nike Air Max 180    Prada Shoes - Official    mulberry outlet    burberry outlet coupon


January 9, 2018 9:25 PM

lzmee said:    official coach outlet site    clearance    business blog    under armour outlet    Nike Schuhe Damen    pandora charms    nike huarache shoes    pandora australia    michael kors outlet    michael kors australia    louboutin shoes    burberry outlet coupon    Nike Air Max 180    ugg boots    Wholesale womens autumn winter clothing    kate spade handbags    snow boots uk    The Retail Compliance Association    Wave Prophecy 2 Shoes    jimmy choo outlet    chrome store    cheap ray ban    tory burch outlet    chanel outlet    pandora jewelry sale    tory burch outlet    Nike Boots    Nike Jordans    puma shoes    yeezy boost 350 shoes    burberry outlet    school bags online    pandora uk    kate spade new york store    louis vuitton outlet    timberland boots    yeezy boost 350    nike outlet    Louis Vuitton Outlet    Prada Shoes - Official    hermes outlet    nbastore    Online Oyun    kate spade    coach outlet online    Louis Vuitton Outlet    burberry outlet sale    Air Max 90 Femme    michael kors    oakley outlet    coach handbags sale    Air Max 1 Homme    pandora rings uk    articles    coach factory outlet    ray ban sunglasses    Nike Air Max 90 Mes    myhermes parcel shop    kate spade canada    Prada Shoes - Official    ray ban justin    michael kors australia    michael kors australia    fun games for kids    ray ban uk    Dreamland Jewelry - Official    Louis Vuitton Online    gel kayano    coach factory outlet    michael kors outlet    kate spade outlet    ray ban sunglasses    mulberry outlet    birkenstock canada    pandora uk    Nike Free Run    Engagement Rings - Official    north face outlet    Air Jordan Homme    ray ban shop    mulberry outlet    Nike Blazer Femmes    omega watches    black friday deals online    Obat Kuat Sex    Nike Free    soccer store    louis vuitton    ray ban wayfarer sunglasses    michael kors uk    pandora ring    jimmy choo heels    black friday deals    pandora necklace    ray ban sunglasses    Nike Schuhe Herren    fulam shoes    kate spade outlet    official louis vuitton    Jared Jewelry - Official">    michael kors uk    pandora outlet    Prada Sunglasses - Official    payless shoes    clb shoes sale    michael kors    Kay Jewelers - Official    puma shoes    louis vuitton us    michael kors australia    kate spade outlet    Nike Air Max 2017    puma oulet sale    timberland boots    ray ban frames    coach factory outlet online    China wholesale    michael kors australia official    nike outlet    sunglasses hut    chanel outlet    birkenstock outlet    ray-ban glasses    michael kors    Kaufen Nike Air Max 1


January 9, 2018 10:15 PM

wef said:    Chanel Outlet    payless shoes    80's Fashion    Nike Air Jordan Enfants    Michael Kors Outlet    Air Jordan Retro 3    ray ban shop    Promise Rings - Official    populaire Nike Lunarmax    puma outlet    coach factory outlet    katespade outlet    Nike Air Force    Coach Bags Outlet    NIKE Schuhe Shop    casio watches    michele watch    oakley australia    Air Jordan 10    qiqi fashion    birkenstock sandals    burberry bags outlet    michael kors shoes    Sunglasses outlet sale    Nike Air Jordan Enfants    ray ban clubmaster sunglasses    Cartier Watches    puma outlet online    hermes bag    louis vuitton outlet    coach factory outlet    clearance    prada outlet woodbury


February 10, 2018 7:23 PM

Leave a Comment


This Blog


Privacy Statement