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
go

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.

Your SQL Trainer
Kevin Urquhart

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

Kevin Urquhart
SQL Server Consultant, London

Categories


Archives


Copyright © 2018 London SQL Server Training Courses @ SQL Training | Website Design From Scott Heron