Worth Corner, Crawley, RH10 7SL

Support Hours - Mon-Sat, 8.00-18.00

Welcome to our SQL Server blog

This blog was created in order to pass on some of our knowledge and advice in the hope that the community might find it useful.

Obviously Microsoft SQL Server is our area of expertise and therefore this is our most thorough blog with everything from the basic through to the the incredibly advanced and, as such, we should have something for everyone within our pages.

Handy Trick in SSMS
Published: Apr 09, 2017
This is a quick post about something I only found out recently and which has made my life so much easier in many circumstances. It’s something I also imagine you’ll soon use a lot too if you don’t already.

It’s basically a solution to a problem that we all face in which we end up having to perform multiple copy and pastes or the repetitive “comma, down arrow, comma, down arrow…” scenario.

So what’s the feature? Well it’s simply holding SHIFT and ALT down whilst using the arrow keys to move your cursor up and down.

This allows you to write on multiple lines at once.

Confused? Okay, here’s a quick (very fabricated) demo:

use AdventureWorks2012

select top 10 name
from sys.tables
where schema_id('sales') = schema_id

Okay, so now we have this we want to do a quick top 1 from each table in our output.

Now, we could of course have written our select to output that command, but that’s not the point here and that can easily get very complicated and sometimes isn’t the best idea.

So… copy and paste the results into SSMS:

Now, place your cursor at the start of the first record (in this case “ShoppingCartItem”). Now, hold SHIFT and ALT and press the down arrow key. You’ll see a grey line being drawn down all the rows:

If you look carefully you’ll see it there… now just start typing and it will appear on each line:

And there you have it… REALLY fast, saves on copy and paste, and works in a LOT of otherwise tedious scenarios. Enjoy!!!

Leave a Comment
Your email address will not be published. All fields are mandatory.
NB: Comments will only appear once they have been moderated.

SQL  World  CEO
Kevin  Urquhart

iPhone Selfie

I am a SQL Server DBA, Architect, Developer, Trainer, and CEO of SQL World. This is my blog in which I’m simply trying to share my SQL knowledge and experiences with the world.


© Copyright 2020 SQLTraining Ltd.