Vertical Selection In SSMS

Bert Wagner shows off vertical selection in SSMS (using the Alt key):

Sometimes when writing an ad hoc query you might want to take the results of one query and put them into an IN() statement of another query.

Sure, you can write a subquery to put into your IN() statement…but that’s too much work for a one-time use disposable query.

What you can do instead is:

  1. Copy your values of interest

  2. Paste them into your IN() statement

  3. Hold down the ALT key while dragging the mouse down in front of all of your pasted values

  4. Type a comma (see video above for an easier demonstration).

For SSMS speedrunning strats, you can also hold down ALT + SHIFT and use your keyboard arrow keys instead of using the mouse.

Related Posts

Attempted To Read Or Write Protected Memory

Kenneth Fisher explains a nasty-looking error to us: So, are you seeing this error? Attempted to read or write protected memory. This is often an indication that other memory is corrupt. If you read the error it might freak you out a bit. The key words memory and corrupt can be a bit .. concerning. Fortunately in this case […]

Read More

Formatting with RegEx in SQL Server

Shane O’Neill has a problem: This is a contrived example but I was given a script that got the “Discipline”, “DocumentVersion”, “DocumentNumber”, “SectionNumber”, and “SectionName” out of the above. And while it works, I hate that formatting. Everything is all squashed and shoved together. No, thanks. Let’s see if we can make this more presentable. […]

Read More

Categories

November 2017
MTWTFSS
« Oct Dec »
 12345
6789101112
13141516171819
20212223242526
27282930